home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / unix / linux_in.zip / INSTALL-.0XT < prev   
Text File  |  1994-05-17  |  538KB  |  14,571 lines

  1.  
  2.  
  3.      Linux Installation and Getting Started
  4.      ------------------------------------------------------------------------
  5.      by Matt Welsh, <mdw@sunsite.unc.edu>
  6.      Version 2.0, 14 January 1994. Copyright (c) 1992--1994 Matt Welsh
  7.  
  8.  
  9.      This book is an installation and new-user guide for  the  Linux  system,
  10.      meant  for UNIX novices and gurus alike. Contained herein is information
  11.      on how to obtain Linux, installation of the software, a beginning  tuto¡
  12.      rial  for  new UNIX users, and an introduction to system administration.
  13.      It is meant to be general enough to be applicable to any distribution of
  14.      the Linux software.  Anyone with interest in installing and running Lin¡
  15.      ux should read this book first.
  16.  
  17.      This book is freely distributable; you may copy and  redistribute  it
  18.      under  certain  conditions.  Please  see  the copyright and distribution
  19.      statement on page 7.
  20.  
  21.  
  22.      Please note: This is the plain ASCII version of this book. It is made
  23.      possible by a lot of hacking and manual editing, and is therefore
  24.      far from perfect. Some examples extend beyond the end of the line, 
  25.      some of the tables don't line up. There aren't any fonts. The chapter
  26.      and section numbers are off by one (the text conversion tool thinks
  27.      that the preface is Chapter 1). However, despite these problems,
  28.      it is still very readable. But the quality pales in comparison to the
  29.      PostScript and .dvi versions of the book, which may be found on 
  30.      sunsite.unc.edu:/pub/Linux/docs/LDP/install-guide. If you have the
  31.      ability to print or view PostScript or .dvi files (for instance, with
  32.      a PostScript printer, using Ghostscript/Ghostview, using xdvi, etc.) 
  33.      I strongly suggest that you read one of those versions instead. This
  34.      plain ASCII is a kludge for those with absolutely no way to view the
  35.      book otherwise. Thanks to Olaf Kirch for his work on the tools used
  36.      to produce this version.
  37.  
  38.      You may order a nicely printed and bound copy of this book from SSC,
  39.      Inc. It is US$15 plus shipping ($3 in the U.S.). They can accept credit 
  40.      card orders (Visa, MasterCard or AmEx). Orders can be phoned in at
  41.      +1 206 FOR-UNIX or +1 206 527 3385, FAXed to +1 206 527 2806, or mailed
  42.      SSC, P.O. Box 55549, Seattle, WA 98155, Inc. They may be contacted
  43.      via Internet e-mail at sales@ssc.com.
  44.  
  45.  
  46.  
  47.                                  - 2 -
  48.  
  49.  
  50.  
  51.      1. Preface
  52.  
  53.      ``You are in a maze of twisty little passages, all alike.''
  54.  
  55.  
  56.           Before you looms one of the most complex and  utterly  intimidating
  57.      systems ever written. Linux, the free operating system for the 80386 and
  58.      80486. Linux, the great  accomplishment  of  the  free  software  world.
  59.      Linux---the name is enough to strike terror into the hearts of men (and,
  60.      of course, women, and perhaps small animals as well).  Not  only  is  it
  61.      difficult to pronounce, it's almost impossible to comprehend.
  62.  
  63.  
  64.           Linux  was  produced by a mishmash team of UNIX gurus, hackers, and
  65.      the occasional loon. The system itself reflects this  complex  heritage.
  66.      The  jungle  is  deep and dangerous. You are entering the realm of black
  67.      magic and deep wizardry, of voodoo programming and  subtle  obfuscation.
  68.      Monsters lurk behind every tree, ready to pounce. Making your way though
  69.      it alone---well, you can forget about that.
  70.  
  71.  
  72.           You hold in your very hands the map  and  guidebook  to  the  many-
  73.      faceted  world  of  Linux. Armed with this guide, neither the novice nor
  74.      the guru need fear this system ever again. In fact, setting up your  own
  75.      Linux system can be a great deal of fun. Sit back. Relax. Read on.
  76.  
  77.  
  78.           This is the second edition of this book. The first edition was spe¡
  79.      cific to the then-popular SLS distribution of Linux.  Since  that  time,
  80.      Linux  has diversified in many ways, and many separate distributions are
  81.      becoming available. This version is a complete installation and new-user
  82.      guide,  intended  to  be  general  for any distribution. The first three
  83.      chapters have been bagged and replaced with two new chapters, much  more
  84.      comprehensive  than  the original. The appendices have been revised, and
  85.      various sections have been tweaked to remain up-to-date  with  the  many
  86.      changes taking place within the Linux community.
  87.  
  88.  
  89.      Audience
  90.  
  91.      This book is for any personal computer user who wants to install and use
  92.      Linux on their system. We assume that you  have  basic  knowledge  about
  93.      personal  computers  and  operating  systems such as MS-DOS. No previous
  94.      knowledge about Linux or UNIX is assumed.
  95.  
  96.  
  97.           Despite this, we strongly suggest that UNIX novices invest  in  one
  98.      of  the  many  good UNIX books out there. (Several of them are listed in
  99.      Appendix A). This book contains information useful to new Linux users,
  100.      but for more advanced information, you'll have to look elsewhere!
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.                                  - 2 -
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.      Organization
  118.  
  119.      In addition to the preface (by a quirk of design, which ended up as
  120.      `Chapter 1' in this plain ASCII version), this book contains the 
  121.      following chapters.
  122.  
  123.  
  124.           Chapter 2, Introduction to Linux, gives a general introduction to
  125.      what Linux is, what it can do for you, and what is required to run it on
  126.      your  system. It also provides helpful hints for getting help and reduc¡
  127.      ing overall stress.
  128.  
  129.  
  130.           Chapter 3, Obtaining and Installing Linux, explains how to  obtain
  131.      the  Linux  software, as well as how to install it---from repartitioning
  132.      your drive, creating filesystems, and loading the software on  the  sys¡
  133.      tem.  It  contains instructions meant to be general for any distribution
  134.      of Linux, and relies on the documentation provided for  your  particular
  135.      release to fill in any gaps.
  136.  
  137.  
  138.           Chapter 4, Linux Tutorial, is a complete introduction to using the
  139.      Linux system for UNIX novices. If you  have  previous  UNIX  experience,
  140.      most of this material should be familiar.
  141.  
  142.  
  143.           Chapter 5, System Administration, introduces many of the important
  144.      concepts of system administration under Linux.  This  will  also  be  of
  145.      interest to UNIX system administrators who want to know about the Linux-
  146.      specific issues of running a system.
  147.  
  148.  
  149.           Chapter 6, Advanced Features, introduces the reader to a number of
  150.      advanced  features  supported  by Linux, such as the X Window System and
  151.      TCP/IP networking.
  152.  
  153.  
  154.           Appendix A, Sources of Linux Information, is a listing  of  other
  155.      sources of information about Linux, including newsgroups, mailing lists,
  156.      online documents, and books.
  157.  
  158.  
  159.           Appendix B, Linux Distribution and Mail Order  List,  provides  a
  160.      short list of available Linux distributions and where to get them.
  161.  
  162.  
  163.           Appendix  C,  FTP Tutorial and Site List, is a tutorial for down¡
  164.      loading files from the Internet with FTP. This appendix also includes  a
  165.      listing of FTP archive sites which carry Linux software.
  166.  
  167.  
  168.           Appendix  D,  Linux BBS List, is a listing of bulletin board sys¡
  169.      tems worldwide which carry Linux software. Because most Linux users  are
  170.      do  not have access to the Internet, it is important that information on
  171.      BBS systems becomes available.
  172.  
  173.  
  174.  
  175.                                  - 3 -
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.           Appendix D, The GNU General Public License, contains  a  copy  of
  186.      the  GNU GPL, the license agreement under which Linux is distributed. It
  187.      is very important that Linux users understand the  GPL;  many  disagree¡
  188.      ments over the terms of the GPL have been raised in recent months.
  189.  
  190.  
  191.      Acknowledgments
  192.  
  193.      This  book  has been long in the making, and many people are responsible
  194.      for the outcome. In particular, I would like to thank  Larry  Greenfield
  195.      and Karl Fogel for their work on the first version of Chapter 4, and to
  196.      Lars Wirzenius for his work on Chapter 5. Thanks to Michael K.  Johnson
  197.      for  his  assistance with the LDP and the LaTeX conventions used in this
  198.      manual, and to Ed Chi, who was nice enough to send me a printed copy  of
  199.      the  book  for edition.  I would also like to thank Andy Oram, Lar Kauf¡
  200.      man, and Bill Hahn at O'Reilly and Associates for their  assistance  and
  201.      interest  in  the Linux Documentation Project. And, of course, a special
  202.      thanks to the many activists, especially Linus Torvalds and  Peter  Mac¡
  203.      Donald, without whom this would not have been possible.
  204.  
  205.  
  206.           Last  but  not least, thanks to the myriad of readers who have sent
  207.      their helpful comments and corrections. Who needs a spell checker,  when
  208.      you have an audience?
  209.  
  210.  
  211.                                                                    Matt Welsh
  212.                                                               13 January 1994
  213.  
  214.  
  215.      Credits and Legalese
  216.  
  217.      The  Linux  Documentation Project is a loose team of writers, proofread¡
  218.      ers, and editors who are working on a set of definitive  Linux  manuals.
  219.      The  overall  coordinator  of  the  project is Matt Welsh, aided by Lars
  220.      Wirzenius and Michael K. Johnson.
  221.  
  222.  
  223.           This manual is but one in a set of several being distributed by the
  224.      Linux  Documentation  Project,  including  a  Linux User's Guide, System
  225.      Administrator's Guide, and Kernel Hacker's Guide. These manuals are  all
  226.      available in LaTeX source format and Postscript output for anonymous FTP
  227.      from sunsite.unc.edu, in the directory /pub/Linux/docs/LDP.
  228.  
  229.  
  230.           We encourage anyone with a penchant for writing or editing to  join
  231.      us in improving Linux documentation. If you have Internet e-mail access,
  232.      you can join the DOC channel of  the  Linux-Activists  mailing  list  by
  233.      sending mail to
  234.  
  235.  
  236.           linux-activists-request@niksula.hut.fi
  237.  
  238.  
  239.  
  240.  
  241.                                  - 4 -
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.           with the line
  252.  
  253.  
  254.           X-Mn-Admin: join DOC
  255.  
  256.  
  257.  
  258.           as the first line of the message body.
  259.  
  260.  
  261.           Feel  free  to get in touch with the author and coordinator of this
  262.      manual if you have questions, postcards, money, or ideas. Matt Welsh can
  263.      be  reached via Internet e-mail at mdw@sunsite.unc.edu, and in real life
  264.      at
  265.  
  266.  
  267.           205 Gray Street
  268.           Wilson, N.C. 27893
  269.           U.S.A.
  270.  
  271.  
  272.  
  273.  
  274.                                  - 5 -
  275.  
  276.  
  277.                                  - 6 -
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.      UNIX is a trademark of Unix System Laboratories.
  286.      Linux is not a trademark, and has no connection to UNIX(tm) or Unix Sys¡
  287.      tem Laboratories.
  288.      The  X  Window  System  is a trademark of the Massachusetts Institute of
  289.      Technology.
  290.      MS-DOS and Microsoft Windows are trademarks of Microsoft, Inc.
  291.  
  292.  
  293.  
  294.      Copyright (C) 1992--1994  Matt Welsh
  295.      205 Gray Street NE, Wilson NC, 27893 USA
  296.      mdw@sunsite.unc.edu
  297.  
  298.  
  299.  
  300.      Linux Installation and Getting Started may be reproduced and distributed
  301.      in whole or in part, subject to the following conditions:
  302.  
  303.  
  304.       01.  The copyright notice above and this permission notice must be pre¡
  305.            served complete on all complete or partial copies.
  306.  
  307.  
  308.       02.  Any translation or derivative work of Linux  Installation,  Setup,
  309.            and  Getting  Started  must  be  approved by the author in writing
  310.            before distribution.
  311.  
  312.  
  313.       03.  If you distribute Linux Installation and Getting Started in  part,
  314.            instructions  for  obtaining  the  complete version of this manual
  315.            must be included, and a means for  obtaining  a  complete  version
  316.            provided.
  317.  
  318.  
  319.       04.  Small  portions  may be reproduced as illustrations for reviews or
  320.            quotes in other works without this  permission  notice  if  proper
  321.            citation is given.
  322.  
  323.  
  324.       05.  The  GNU General Public License referenced below may be reproduced
  325.            under the conditions given within it.
  326.  
  327.  
  328.       06.  Several sections of this document are held  under  separate  copy¡
  329.            right.  When  these sections are covered by a different copyright,
  330.            the separate copyright is noted.  If you distribute Linux  Instal¡
  331.            lation  and  Getting  Started in part, and that part is, in whole,
  332.            covered under a separate, noted copyright, the conditions of  that
  333.            copyright apply.
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.                                  - 7 -
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.           Exceptions  to  these  rules  may be granted for academic purposes:
  352.      Write to Matt Welsh, at the above address, or email mdw@sunsite.unc.edu,
  353.      and  ask.   These restrictions are here to protect us as authors, not to
  354.      restrict you as educators and learners.
  355.  
  356.  
  357.           I encourage distributors of Linux software in any medium to use the
  358.      book  as  an  installation  and  new user guide. After all, that's why I
  359.      wrote it!  Given the copyright above, you are free  to  print  and  dis¡
  360.      tribute  copies  of  this  book  with your distribution. You may wish to
  361.      include a short ``installation supplement'' for your  release,  as  this
  362.      book  only  contains  general  installation material. Nevertheless, many
  363.      readers have found it to be useful.
  364.  
  365.  
  366.  
  367.      All source code in Linux Installation  and  Getting  Started  is  placed
  368.      under  the  GNU  General Public License.  See Appendix D for a copy of
  369.      the GNU ``GPL.''
  370.  
  371.  
  372.      Documentation Conventions
  373.  
  374.      These conventions should be obvious, but we'll include them here for the
  375.      pedantic. (Please note that this ASCII version doesn't include fonts,
  376.      because not all terminals will be able to handle them.)
  377.  
  378.  
  379.  
  380.  
  381.              * Bold  Used  to  mark new concepts, WARNINGS, and keywords in a
  382.                language.
  383.  
  384.  
  385.              * italics Used for emphasis in text, and occasionally for quotes
  386.                or  introductions at the beginning of a section.  Also used to
  387.                indicate commands for the user to  type  when  showing  screen
  388.                interaction (see below).
  389.  
  390.  
  391.              * <slanted>  Used to mark meta-variables in the text, especially
  392.                in representations of the command line.  For example,
  393.  
  394.  
  395.                     ls -l <foo>
  396.                     where <foo> would  ``stand  for''  a  filename,  such  as
  397.                /bin/cp.
  398.  
  399.  
  400.              * Typewriter Used to represent screen interaction, as in
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.                                  - 8 -
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.                 $ ls -l /bin/cp
  419.                 -rwxr-xr-x   1  root     wheel     12104 Sep 25 15:53 /bin/cp
  420.  
  421.  
  422.  
  423.  
  424.                     Also used for code examples, whether  it  is  C  code,  a
  425.                shell script, or something else, and to display general files,
  426.                such as configuration files.   When  necessary  for  clarity's
  427.                sake,  these  examples  or  figures  will  be enclosed in thin
  428.                boxes.
  429.  
  430.  
  431.              * `Key' Represents a key to press.  You will  often  see  it  in
  432.                this form:
  433.  
  434.  
  435.                     Press `return' to continue.
  436.  
  437.  
  438.              * <>  A  diamond  in  the  margin, like a black diamond on a ski
  439.                hill, marks ``danger'' or ``caution.''  Read paragraphs marked
  440.                this way carefully.
  441.  
  442.  
  443.  
  444.  
  445.                                  - 9 -
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.      2.  Introduction to Linux
  456.  
  457.  
  458.  
  459.  
  460.           Linux  is  quite  possibly  the  most important achievement of free
  461.      software since the original Space War, or, more  recently,  Emacs.  This
  462.      book  will  be  your guide to its shifting and many-faceted world. Linux
  463.      has developed into the operating system for businesses,  education,  and
  464.      personal productivity. It is no longer just for UNIX wizards who sit for
  465.      hours in front of the glowing console (although we assure you that quite
  466.      a  number  of  users still fall into this category). This book will help
  467.      you get the most out of it.
  468.  
  469.  
  470.           Linux (pronounced with a short i, as in LIH-nucks) is  a  clone  of
  471.      the  UNIX operating system that runs on Intel 80386 and 80486 computers.
  472.      It supports a wide range of software, from TeX to X Windows to  the  GNU
  473.      C/C++ compiler to TCP/IP.  It's a versatile, bona fide implementation of
  474.      UNIX, freely distributed by the terms of the GNU General Public  License
  475.      (see Appendix D).
  476.  
  477.  
  478.           Linux  can  turn any 386 or 486 PC into a workstation. It will give
  479.      you the full power of UNIX at your fingertips. Businesses are installing
  480.      Linux on entire networks of machines, using the operating system to man¡
  481.      age financial and hospital records, a distributed user  computing  envi¡
  482.      ronment,  telecommunications, and more. Universities worldwide are using
  483.      Linux for teaching courses on operating systems programming and  design.
  484.      And,  of  course,  computing  enthusiasts  everywhere are using Linux at
  485.      home, for programming, productivity, and all-around hacking.
  486.  
  487.  
  488.           What makes Linux so different is that it is a  free  implementation
  489.      of UNIX. It was and still is developed by a group of volunteers, primar¡
  490.      ily on the Internet, exchanging code, reporting bugs, and  fixing  prob¡
  491.      lems  in  an  open-ended  environment.  Anyone is welcome to join in the
  492.      Linux development effort: all it takes is interest  in  hacking  a  free
  493.      UNIX clone and some kind of programming know-how. The book that you hold
  494.      in your hands is your tour guide.
  495.  
  496.  
  497.      2.1  About This Book
  498.  
  499.      This book is an installation and entry-level guide to the Linux  system.
  500.      The  purpose  is to get new users up and running with the system by con¡
  501.      solodating as  much  important  material  as  possible  into  one  book.
  502.      Instead of covering many of the volatile technical details, those things
  503.      which tend to change with rapid development, we give  you  enough  back¡
  504.      ground to find out more on your own.
  505.  
  506.  
  507.           Linux  is  not  difficult  to install and use. However, as with any
  508.      implementation of UNIX, there is often some black magic involved to  get
  509.  
  510.  
  511.                                 - 10 -
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.      everything working correctly. We hope that this book will get you on the
  522.      Linux tourbus and show you how groovy this operating system can be.
  523.  
  524.  
  525.           In this book, we cover the following topics.
  526.  
  527.  
  528.              * What is Linux? The design and philosophy of this unique  oper¡
  529.                ating system, and what it can do for you.
  530.  
  531.  
  532.              * All  of  the details of what is needed to run Linux, including
  533.                suggestions on what kind of hardware configuration  is  recom¡
  534.                mended for a complete system.
  535.  
  536.  
  537.              * How  to obtain and install Linux. There are many distributions
  538.                of the Linux software. We present a number of them,  and  dis¡
  539.                cuss  how to install the Linux software from one of the avail¡
  540.                able distributions.
  541.  
  542.  
  543.              * A brief introductory UNIX tutorial, for those users  who  have
  544.                never  had  experience with UNIX before. This tutorial should,
  545.                hopefully, provide enough material  for  complete  novices  to
  546.                have  enough  basic know-how to find their way around the sys¡
  547.                tem.
  548.  
  549.  
  550.              * An introduction to systems  administration  with  Linux.  This
  551.                covers  the most important tasks that new Linux administrators
  552.                will need to be familiar with, such as creating users,  manag¡
  553.                ing filesystems, and so forth.
  554.  
  555.  
  556.              * A  cursory overview of advanced features of Linux, such as the
  557.                X Window System, networking with  TCP/IP  and  SLIP,  and  the
  558.                setup of electronic mail and news systems.
  559.  
  560.  
  561.  
  562.  
  563.  
  564.           This  book is for the personal computer user wishing to get started
  565.      with Linux. We don't assume previous  UNIX  experience,  but  do  expect
  566.      novices to refer to other materials along the way.  For those unfamiliar
  567.      with UNIX, a list of useful sources of information is given in  Appendix
  568.      A.  In  general, this book is meant to be read along with another book
  569.      on basic UNIX concepts.
  570.  
  571.  
  572.      2.2  A Brief History of Linux
  573.  
  574.      UNIX is one of the most popular operating systems worldwide  because  of
  575.  
  576.  
  577.                                 - 11 -
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.      its  large support base and distribution. It was originally developed as
  588.      a  multitasking  system  for  minicomputers  and   mainframes   in   the
  589.      mid-1970's,  but  has  since grown to become one of the most widely used
  590.      operating systems anywhere, despite its  sometimes  confusing  interface
  591.      and lack of central standardization.
  592.  
  593.  
  594.           The  real reason for UNIX's popularity? Many hackers feel that UNIX
  595.      is the Right Thing---the One True Operating System. Hence, the  develop¡
  596.      ment  of  Linux  by  an  expanding group of UNIX hackers who want to get
  597.      their hands dirty with their own system.
  598.  
  599.  
  600.           Versions of UNIX exist for  many  systems---ranging  from  personal
  601.      computers  to to supercomputers such as the Cray Y-MP.  Most versions of
  602.      UNIX for personal computers are quite expensive and cumbersome.  At  the
  603.      time  of  this writing, a one-machine version of AT&T's System V for the
  604.      386 runs at about US$1500.
  605.  
  606.  
  607.           Linux is a freely distributable version of UNIX developed primarily
  608.      by  Linus  Torvalds  (1) at the University of Helsinki in Finland. Linux
  609.      was developed with the help of many UNIX programmers and wizards  across
  610.      the  Internet,  allowing  anyone  with  enough know-how and gumption the
  611.      ability to develop and change the system.  The Linux kernel uses no code
  612.      from  AT&T  or  any  other  proprietary source, and much of the software
  613.      available for Linux is developed by the GNU project at the Free Software
  614.      Foundation  in  Cambridge,  Massachusetts. However, programmers all over
  615.      the world have contributed to the growing pool of Linux software.
  616.  
  617.  
  618.           Linux was originally developed as a hobby  project  by  Linus  Tor¡
  619.      valds.   It was inspired by Minix, a small UNIX system developed by Andy
  620.      Tanenbaum, and the first discussions about  Linux  were  on  the  USENET
  621.      newsgroup  comp.os.minix.  These  discussions were concerned mostly with
  622.      the development of a small, academic UNIX system  for  Minix  users  who
  623.      wanted more.
  624.  
  625.  
  626.           The  very  early  development  of Linux was mostly dealing with the
  627.      task-switching features of the 80386 protected-mode interface, all writ¡
  628.      ten in assembly code. Linus writes,
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.      
  640.  
  641.      1. torvalds@kruuna.helsinki.fi.
  642.  
  643.                                 - 12 -
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.           ``After  that  is  was plain sailing: hairy coding still,
  654.           but I had some devices,  and  debugging  was  easier.   I
  655.           started using C at this stage, and it certainly speeds up
  656.           developement. This is also when I start  to  get  serious
  657.           about  my megalomaniac ideas to make "a better Minix than
  658.           Minix". I was hoping I'd be able to recompile  gcc  under
  659.           Linux some day...
  660.           ``Two  months  for  basic  setup,  but then only slightly
  661.           longer until I had a disk-driver (seriously buggy, but it
  662.           happened  to  work on my machine) and a small filesystem.
  663.           That was about when I made 0.01  available  [around  late
  664.           August  of  1991]:  it  wasn't  pretty,  it had no floppy
  665.           driver, and it couldn't do much anything.  I don't  think
  666.           anybody  ever  compiled  that version.  But by then I was
  667.           hooked, and didn't want to stop until I could  chuck  out
  668.           Minix.''
  669.  
  670.  
  671.  
  672.           No  announcement  was  ever  made  for Linux version 0.01. The 0.01
  673.      sources weren't even executable: they contained only the bare  rudiments
  674.      of the kernel source, and assumed that you had access to a Minix machine
  675.      to compile and play with them.
  676.  
  677.  
  678.           On 5 October 1991, Linus announced the first  ``official''  version
  679.      of  Linux,  version 0.02. At this point, Linus was able to run bash (the
  680.      GNU Bourne Again Shell) and gcc (the GNU C compiler), but not very  much
  681.      else  was  working.  Again,  this was intended as a hacker's system. The
  682.      primary focus was kernel development---none of the issues of  user  sup¡
  683.      port,  documenation,  distribution,  and  so on had even been addressed.
  684.      Today, the Linux community still seems to treat these  ergonomic  issues
  685.      as secondary to the ``real programming''---kernel development.
  686.  
  687.  
  688.           Linus wrote in comp.os.minix,
  689.  
  690.           ``Do  you  pine  for the nice days of Minix-1.1, when men
  691.           were men and wrote their  own  device  drivers?  Are  you
  692.           without  a  nice project and just dying to cut your teeth
  693.           on a OS you can try to modify for  your  needs?  Are  you
  694.           finding it frustrating when everything works on Minix? No
  695.           more all-nighters to get a nifty  program  working?  Then
  696.           this post might be just for you.
  697.           ``As  I mentioned a month ago, I'm working on a free ver¡
  698.           sion of a Minix-lookalike for AT-386 computers.   It  has
  699.           finally  reached the stage where it's even usable (though
  700.           may not be depending on what you want), and I am  willing
  701.           to  put  out  the  sources for wider distribution.  It is
  702.           just version 0.02...but I've successfully run bash,  gcc,
  703.           gnu-make, gnu-sed, compress, etc. under it.''
  704.  
  705.  
  706.  
  707.  
  708.  
  709.                                 - 13 -
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.           After  version 0.03, Linus bumped the version number up to 0.10, as
  720.      more people started to work on the system. After several  further  revi¡
  721.      sions, Linus increased the version number to 0.95, to reflect his expec¡
  722.      tation that the system was ready for an ``official'' release very  soon.
  723.      (Generally,  software is not assigned the version number 1.0 until it is
  724.      theoretically complete or bug-free.) This was in March of 1992. Almost a
  725.      year  and  a  half later, in late December of 1993, the Linux kernel was
  726.      still at version 0.99.pl14---asymptotically approaching 1.0.  Some  felt
  727.      that version 1.0 would never make it.
  728.  
  729.  
  730.           Today,  Linux  is  a  complete  UNIX, capable of running X Windows,
  731.      TCP/IP, Emacs, UUCP, mail and news software, you name it. Almost all  of
  732.      the  major free software packages have been ported to Linux, and commer¡
  733.      cial software is becoming available.  Much more  hardware  is  supported
  734.      than  in  original  versions  of  the kernel.  Many people have executed
  735.      benchmarks on 80486 Linux systems and found them  comparable  with  mid-
  736.      range  workstations from Sun Microsystems and Digital Equipment Corpora¡
  737.      tion. Who would have ever guessed that this ``little'' UNIX clone  would
  738.      have grown up to take on the entire world of personal computing?
  739.  
  740.  
  741.      2.3  System Features
  742.  
  743.      Linux  supports  most  of the features found in other implementations of
  744.      UNIX, plus quite a few that aren't found elsewhere. This  section  is  a
  745.      nickel tour of the Linux kernel features.
  746.  
  747.  
  748.           Linux  is a complete multitasking, multiuser operating system (just
  749.      like all other versions of UNIX). This means  that  many  users  can  be
  750.      logged into the same machine at once, running multiple programs simulta¡
  751.      neously.
  752.  
  753.  
  754.           The Linux system is mostly compatible with a number of  UNIX  stan¡
  755.      dards  (inasmuch  as  UNIX has standards) on the source level, including
  756.      IEEE POSIX.1, System V, and BSD features.  It was developed with  source
  757.      portability  in  mind:  therefore, you are most likely to find commonly-
  758.      used features in the Linux  system  which  are  shared  across  multiple
  759.      implementations.  A  great  deal  of free UNIX software available on the
  760.      Internet and elsewhere compiles on Linux out of the  box.  In  addition,
  761.      all  source  code  for  the  Linux  system, including the kernel, device
  762.      drivers, libraries, user programs, and development tools, is freely dis¡
  763.      tributable.
  764.  
  765.  
  766.           Other specific internal features of Linux include POSIX job control
  767.      (used by shells such as csh and bash),  pseudoterminals  (pty  devices),
  768.      and  support  for  national  or  customized keyboards using dynamically-
  769.      loadable keyboard drivers. Linux also supports virtual  consoles,  which
  770.      allow you to switch between multiple login sessions from the system con¡
  771.      sole in text mode. Users of the ``screen'' program will find  the  Linux
  772.      virtual console implementation familiar.
  773.  
  774.  
  775.                                 - 14 -
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.           The  kernel is able to emulate 387-FPU instructions itself, so that
  786.      systems without a math coprocessor can run programs that require  float¡
  787.      ing-point math instructions.
  788.  
  789.  
  790.           Linux  supports  various filesystem types for storing data. Various
  791.      filesystems, such as the ext2fs filesystem, have been developed specifi¡
  792.      cally  for Linux.  Other filesystem types, such as the Minix-1 and Xenix
  793.      filesystems, are also supported. The MS-DOS filesystem has  been  imple¡
  794.      mented as well, allowing you to access MS-DOS files directly by mounting
  795.      an MS-DOS partition or floppy. The  ISO  9660  CD-ROM  filesystem  type,
  796.      which  reads  all standard formats of CD-ROMs, is also supported.  We'll
  797.      talk more about filesystems in Chapters 3. and 5..
  798.  
  799.  
  800.           Linux provides a complete implementation of TCP/IP networking. This
  801.      includes  device  drivers  for many popular Ethernet cards, SLIP (Serial
  802.      Line Internet Protocol, allowing you to access a TCP/IP  network  via  a
  803.      serial  connection), PLIP (Parallel Line Internet Protocol), PPP (Point-
  804.      to-Point Protocol), NFS, and so on. The complete range of TCP/IP clients
  805.      and  services  is  supported, such as FTP, telnet, NNTP, and SMTP. We'll
  806.      talk more about networking in Chapter 6..
  807.  
  808.  
  809.           The Linux kernel is developed to  use  the  special  protected-mode
  810.      features  of the Intel 80386 and 80486 processors.  In particular, Linux
  811.      makes use  of  the  protected-mode  descriptor-based  memory  management
  812.      paradigm  and  many  of the other advanced features of these processors.
  813.      Anyone familiar with 80386 protected-mode programming  knows  that  this
  814.      chip  was designed for a multitasking system such as UNIX (or, actually,
  815.      Multics). Linux exploits this functionality.
  816.  
  817.  
  818.           The Linux kernel supports demand-paged loaded executables. That is,
  819.      only  those  segments of a program which are actually used are read into
  820.      memory from disk. Also, copy-on-write pages are  shared  among  executa¡
  821.      bles,  meaning  that  if  several  instances of a program are running at
  822.      once, they will share pages in physical memory, reducing overall  memory
  823.      usage.
  824.  
  825.  
  826.           In  order  to  increase  the amount of available memory, Linux also
  827.      implements  disk  paging:  that  is,  up  to  256  megabytes  of  ``swap
  828.      space''(2) can be allocated on disk. When the system requires more phys¡
  829.      ical  memory, it will swap out inactive pages to disk, thus allowing you
  830.      to run larger applications and support more users at once. However, swap
  831.      is  no  substitute  for  physical  RAM---it  is much slower due to drive
  832.      access latency times.
  833.  
  834.  
  835.      
  836.  
  837.      2. Swap space is inappropriately named: entire processes are
  838.         not swapped, but rather individual pages. Of  course,  in
  839.         many cases entire processes will be swapped out, but this
  840.         is not neccessarily always the case.
  841.  
  842.                                 - 15 -
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.           The kernel also implements a unified memory pool for user  programs
  853.      and  disk  cache.  In this way, all free memory is used for caching, and
  854.      the cache is reduced when running large programs.
  855.  
  856.  
  857.           Executables use dynamically linked shared libraries,  meaning  that
  858.      executables  share common library code in a single library file found on
  859.      disk, not unlike the SunOS shared library mechanism.  This  allows  exe¡
  860.      cutable  files  to occupy much less space on disk, especially those that
  861.      use many library functions. There are also  statically-linked  libraries
  862.      for those who wish to use object debugging or maintain ``complete'' exe¡
  863.      cutables without the need for shared libraries to  be  in  place.  Linux
  864.      shared  libraries  are dynamically linked at run-time, allowing the pro¡
  865.      grammer to replace modules of the libraries with their own routines.
  866.  
  867.  
  868.           To facilitate debugging, the Linux kernel does core dumps for post-
  869.      mortem  analysis. Using a core dump and an executable linked with debug¡
  870.      ging support, it is possible to  determine  what  caused  a  program  to
  871.      crash.
  872.  
  873.  
  874.      2.4  Software Features
  875.  
  876.      In  this  section,  we'll introduce you to many of the software applica¡
  877.      tions available for Linux, and talk about a number of  common  computing
  878.      tasks.   After  all,  the  most important part of the system is the wide
  879.      range of software available for it. The fact that most of this  software
  880.      is freely distributable is even more impressive.
  881.  
  882.  
  883.      2.4.1  Basic commands and utilities
  884.  
  885.      Virtually  every  utility that you would expect to find on standard imn¡
  886.      plementations of UNIX has been ported to Linux. This includes basic com¡
  887.      mands  such as ls, awk, tr, sed, bc, more, and so on. You name it, Linux
  888.      has it. Therefore, you can expect your familiar working  environment  on
  889.      other  UNIX  systems to be duplicated on Linux. All of the standard com¡
  890.      mands and utilities are there. (Novice Linux users should see Chapter 4.
  891.      for an introduction to these basic UNIX commands.)
  892.  
  893.  
  894.           Many  text  editors are available, including vi, ex, pico, jove, as
  895.      well as GNU Emacs and variants such as Lucid Emacs  (which  incorporates
  896.      extensions for use under X Windows) and joe. Whatever text editor you're
  897.      accustomed to using has more than likely been ported to Linux.
  898.  
  899.  
  900.           The choice of a text editor is an interesting one. Many UNIX  users
  901.      still  use ``simple'' editors such as vi (in fact, the author wrote this
  902.      book using vi under Linux). However, vi has many limitations, due to its
  903.      age,  and  more  modern  (and complex) editors such as Emacs are gaining
  904.      popularity.  Emacs supports a complete  LISP-based  macro  language  and
  905.      interpreter, a powerful command syntax, and other fun-filled extensions.
  906.  
  907.  
  908.                                 - 16 -
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.      Emacs macro packages exist to allow you  to  read  electronic  mail  and
  919.      news,  edit  the  contents of directories, and even engage in an artifi¡
  920.      cially intelligent psychotherapy session (indispensible for stressed-out
  921.      Linux hackers).
  922.  
  923.  
  924.           One  interesting note is that most of the basic Linux utilities are
  925.      GNU software.  These GNU utilities support advanced features  not  found
  926.      in the standard versions from BSD or AT&T. For example, GNU's version of
  927.      the vi editor, elvis, includes a structured macro language which differs
  928.      from  the  original  AT&T  implementation.   However,  the GNU utilities
  929.      strive to remain compatible with their BSD and  System  V  counterparts.
  930.      Many  people consider the GNU versions of these programs superior to the
  931.      originals.
  932.  
  933.  
  934.           The most important utility to many users is the shell.   The  shell
  935.      is  a  program which reads and executes commands from the user. In addi¡
  936.      tion, many shells provide features such as  job  control  (allowing  the
  937.      user  to  manage several running processes at once---not as Orwellian as
  938.      it sounds), input and output redirection, and  a  command  language  for
  939.      writing shell scripts.  A shell script is a file containing a program in
  940.      the shell command language, analogous to a ``batch file'' under  MS-DOS.
  941.  
  942.  
  943.           There are many types of shells available for Linux. The most impor¡
  944.      tant difference between shells is the command language. For example, the
  945.      C  Shell  (csh)  uses a command language somewhat like the C programming
  946.      language. The classic Bourne Shell uses a  different  command  language.
  947.      One's  choice  of a shell is often based on the command language that it
  948.      provides. The shell that you use defines, to some extent,  your  working
  949.      environment under Linux.
  950.  
  951.  
  952.           No  matter  what shell you're accustomed to, some version of it has
  953.      probably been ported to Linux. The most popular shell is the GNU  Bourne
  954.      Again  Shell (bash), a Bourne shell variant which includes many advanced
  955.      features, such as job control, command  history,  command  and  filename
  956.      completion,  an  Emacs-like  interface for editing the command line, and
  957.      powerful extensions to the standard Bourne shell language. Another popu¡
  958.      lar  shell is tcsh, a version of the C Shell with advanced functionality
  959.      similar to that found in  bash.   Other  shells  include  zsh,  a  small
  960.      Bourne-like  shell;  the Korn shell (ksh); BSD's ash; and rc, the Plan 9
  961.      shell.
  962.  
  963.  
  964.           What's so important about these of basic  utilities?   Linux  gives
  965.      you  the unique opportunity to tailor a custom system to your needs. For
  966.      example, if you're the only person who uses your system, and you  prefer
  967.      to  exclusively  use  the  vi editor, and bash as your shell, there's no
  968.      reason to install other editors or shells.  The ``do it yourself'' atti¡
  969.      tude is prevalent among Linux hackers and users.
  970.  
  971.  
  972.  
  973.  
  974.                                 - 17 -
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.      2.4.2  Text processing and word processing
  985.  
  986.      Almost every computer user has a need for some kind of document prepara¡
  987.      tion system. (How many computer enthusiasts do you know  who  still  use
  988.      pen and paper? Not many, we'll wager.)  In the PC world, word processing
  989.      is the norm: it involves editing  and  manipulating  text  (often  in  a
  990.      ``What-You-See-Is-What-You-Get''   environment)  and  producing  printed
  991.      copies of the text, complete with figures, tables, and other  garneshes.
  992.  
  993.  
  994.           In  the  UNIX  world, text processing is much more common, which is
  995.      quite different than the classical concept of word processing.   With  a
  996.      text processing system, text is entered by the author using a ``typeset¡
  997.      ting language'', which describes  how  the  text  should  be  formatted.
  998.      Instead  of  entering  the text within a special word processing envion¡
  999.      ment, the source may be modified with any text  editor  such  as  vi  or
  1000.      Emacs.  Once  the source text (in the typesetting language) is complete,
  1001.      the user formats the text with a separate program,  which  converts  the
  1002.      source to a format suitable for printing.  This is somewhat analogous to
  1003.      programming in a language such as C, and ``compiling'' the document into
  1004.      a printable form.
  1005.  
  1006.  
  1007.           There  are many text processing systems available for Linux. One is
  1008.      groff, the GNU version of the classic nroff  text  formatter  originally
  1009.      developed  by  Bell  Labs and still used on many UNIX systems worldwide.
  1010.      Another modern text processing system is TeX, developed by Donald  Knuth
  1011.      of  computer  science  fame.   Dialects  of TeX, such as LaTeX, are also
  1012.      available.
  1013.  
  1014.  
  1015.           Text processors such as TeX and groff differ mostly in  the  syntax
  1016.      of their formatting languages.  The choice of one formatting system over
  1017.      another is also based upon what utilities are available to satisfy  your
  1018.      needs, as well as personal taste.
  1019.  
  1020.  
  1021.           For  example, some people consider the groff formatting language to
  1022.      be a bit obscure, so they use TeX, which is  more  readable  by  humans.
  1023.      However, groff is capable of producing plain ASCII output, viewable on a
  1024.      terminal, while TeX is intended  primarily  for  output  to  a  printing
  1025.      device. However, various programs exist to produce plain ASCII from TeX-
  1026.      formatted documents, or to convert TeX to groff, for example.
  1027.  
  1028.  
  1029.           Another text processing system is texinfo, an extension to TeX used
  1030.      for  software documentation by the Free Software Foundation.  texinfo is
  1031.      capable of producing a printed document, or an  online-browsable  hyper¡
  1032.      text  ``Info''  document  from  a single source file. Info files are the
  1033.      main format of documentation used by GNU software such as Emacs.
  1034.  
  1035.  
  1036.           Text processors are used widely in the computing community for pro¡
  1037.      ducing  papers, theses, magazine articles, and books (in fact, this book
  1038.  
  1039.  
  1040.                                 - 18 -
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.      was produced using LaTeX). The ability to process the source language as
  1051.      a  plain text file opens the door to many extensions to the text proces¡
  1052.      sor itself. Because source documents are not stored in an  obscure  for¡
  1053.      mat,  readable only by a particular word processor, programmers are able
  1054.      to write parsers and translators for the formatting language,  extending
  1055.      the system.
  1056.  
  1057.  
  1058.           What  does  such  a  formatting language look like? In general, the
  1059.      formatting language source consists mostly of  the  text  itself,  along
  1060.      with  ``control codes'' to produce a particular effect, such as changing
  1061.      fonts, setting margins, creating lists, and so on.
  1062.  
  1063.  
  1064.           As an example, take the following text:
  1065.  
  1066.  
  1067.           Mr. Torvalds:
  1068.  
  1069.  
  1070.           We are very upset with your current  plans  to  implement
  1071.           post-hypnotic  suggestion  in  the  Linux terminal driver
  1072.           code. We feel this way for three reasons:
  1073.  
  1074.            01.  Planting subliminal messages in the terminal driver
  1075.                 is not only immoral, it is a waste of time;
  1076.  
  1077.            02.  It  has  been  proven  that ``post-hypnotic sugges¡
  1078.                 tions'' are ineffective when used upon unsuspecting
  1079.                 UNIX hackers;
  1080.  
  1081.            03.  We  have  already implemented high-voltage electric
  1082.                 shocks, as a security  measure,  in  the  code  for
  1083.                 login.
  1084.  
  1085.           We hope you will reconsider.
  1086.  
  1087.  
  1088.  
  1089.           This text would appear in the LaTeX formatting language as the fol¡
  1090.      lowing:
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.                                 - 19 -
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.           \\begin\{quote\}
  1117.           Mr. Torvalds:
  1118.  
  1119.           We are very upset with your current plans to implement \{\\em post-hypnotic
  1120.           suggestion\\/\} in the \{\\bf Linux\} terminal driver code. We feel this
  1121.           way for three reasons:
  1122.           \\begin\{enumerate\}
  1123.           \\item Planting subliminal messages in the kernel driver is not only
  1124.                 immoral, it is a waste of time\;
  1125.           \\item It has been proven that ``post-hypnotic suggestions'' are ineffective
  1126.                 when used upon unsuspecting UNIX hackers\;
  1127.           \\item We have already implemented high-voltage electric shocks, as a
  1128.                 security measure, in the code for \{\\tt login\}.
  1129.           \\end\{enumerate\}
  1130.           We hope you will reconsider.
  1131.           \\end\{quote\}
  1132.  
  1133.  
  1134.  
  1135.  
  1136.           The author enters the above ``source'' text using any text  editor,
  1137.      and  generates the formatted output by processing the source with LaTeX.
  1138.      At first glance, the typesetting language may appear to be obscure,  but
  1139.      it's  actually  quite  easy  to  learn.  Using  a text processing system
  1140.      enforces typographical standards when writing. For example, all  enumer¡
  1141.      ated lists within a document will look the same, unless the author modi¡
  1142.      fies the definition of the enumerated list ``environment''. The  primary
  1143.      goal  is  to allow the author to concentrate on writing the actual text,
  1144.      instead of worrying about typesetting conventions.
  1145.  
  1146.  
  1147.           WYSIWYG word processors are attractive for many reasons; they  pro¡
  1148.      vide a powerful (and sometimes complex) visual interface for editing the
  1149.      document. However, this interface is inherently limited to those aspects
  1150.      of  text layout which are accessible to the user. For example, many word
  1151.      processors provide a special ``format language'' for  producing  compli¡
  1152.      cated  expressions such as mathematical formulae. This is identical text
  1153.      processing, albeit on a much smaller scale.
  1154.  
  1155.  
  1156.           The subtle benefit of text processing is that the system allows you
  1157.      to  specify  exactly  what you mean. Also, text processing systems allow
  1158.      you to edit the source text with any text editor, and the source is eas¡
  1159.      ily  converted  to other formats.  The tradeoff for this flexibility and
  1160.      power is the lack of a WYSIWYG interface.
  1161.  
  1162.  
  1163.           Many users of word processors are used to seeing the formatted text
  1164.      as  they edit it. On the other hand, when writing with a text processor,
  1165.      one generally does not worry about how the text will appear when format¡
  1166.      ted.  The writer learns to expect how the text should look from the for¡
  1167.      matting commands used in the source.
  1168.  
  1169.  
  1170.  
  1171.  
  1172.                                 - 20 -
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.           There are programs which allow you to view the  formatted  document
  1183.      on  a  graphics  display  before printing. For example, the xdvi program
  1184.      displays a ``device independent'' file generated by the TeX system under
  1185.      the  X  Windows  environment. Other software applications, such as xfig,
  1186.      provide a WYSIWYG graphics interface for drawing figures  and  diagrams,
  1187.      which  are  subsequently  converted  to the text processing language for
  1188.      inclusion in your document.
  1189.  
  1190.  
  1191.           Admittedly, text processors such as nroff were around  long  before
  1192.      word  processing was available. However, many people still prefer to use
  1193.      text processing, because it is  more  versatile  and  independent  of  a
  1194.      graphics  environment.  In  either case, the idoc word processor is also
  1195.      available for Linux, and before long we expect to  see  commercial  word
  1196.      processors  becoming  available as well. If you absolutely don't want to
  1197.      give up word processing for text processing, you can always run  MS-DOS,
  1198.      or some other operating system, in addition to Linux.
  1199.  
  1200.  
  1201.           There  are  many other text-processing-related utilities available.
  1202.      The powerful METAFONT system, used  for  designing  fonts  for  TeX,  is
  1203.      included  with  the Linux port of TeX. Other programs include ispell, an
  1204.      interactive spell checker and corrector; makeindex, used for  generating
  1205.      indicies  in  LaTeX documents; as well as many groff and TeX-based macro
  1206.      packages for formatting many types of documents and mathematical  texts.
  1207.      Conversion programs to translate between TeX or groff source to a myriad
  1208.      of other formats are available.
  1209.  
  1210.  
  1211.      2.4.3  Programming languages and utilities
  1212.  
  1213.      Linux provides a complete UNIX programming environment, including all of
  1214.      the standard libraries, programming tools, compilers, and debuggers that
  1215.      you would expect to find on other UNIX systems.  Within the  UNIX  soft¡
  1216.      ware  development world, applications and systems programming is usually
  1217.      done in C or C++. The standard C and C++ compiler  for  Linux  is  GNU's
  1218.      gcc,  which is an advanced, modern compiler supporting many options.  It
  1219.      also capable of compiling C++ (including AT&T 3.0 features) as  well  as
  1220.      Objective-C, another object-oriented dialect of C.
  1221.  
  1222.  
  1223.           Besides  C and C++, many other compiled and interpreted programming
  1224.      languages have been ported to Linux, such as Smalltalk, FORTRAN, Pascal,
  1225.      LISP,  Scheme,  and  Ada  (if  you're  masochistic  enough to program in
  1226.      Ada---we're not going to stop you). In addition, various assemblers  for
  1227.      writing  protected-mode  80386  code  are available, as are UNIX hacking
  1228.      favorites such as Perl (the script language to end all script languages)
  1229.      and Tcl/Tk (a shell-like command processing system including support for
  1230.      developing simple X Windows applications).
  1231.  
  1232.  
  1233.           The advanced gdb debugger has been ported, which allows you to step
  1234.      through a program to find bugs, or examine the cause for a crash using a
  1235.      core dump.  gprof,  a  profiling  utility,  will  give  you  performance
  1236.  
  1237.  
  1238.                                 - 21 -
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.      statistics  for  your  program,  letting  you know where your program is
  1249.      spending most of its time executing. The Emacs text editor  provides  an
  1250.      interactive  editing and compilation environment for various programming
  1251.      languages.  Other tools include GNU make and imake, used to manage  com¡
  1252.      pilation of large applications; and RCS, a system for source locking and
  1253.      revision control.
  1254.  
  1255.  
  1256.           Linux implements dynamically-linked shared libraries,  which  allow
  1257.      binaries  to  be  much  smaller as the subroutine code is linked at run-
  1258.      time. These DLL libraries also  allow  the  applications  programmer  to
  1259.      override  function  definitions  with  their own code. For example, if a
  1260.      programmer wished to write her own version of the malloc() library  rou¡
  1261.      tine,  the  linker would use the programmer's new routine instead of the
  1262.      one found in the libraries.
  1263.  
  1264.  
  1265.           Linux is ideal for developing UNIX applications. It provides a mod¡
  1266.      ern  programming environment with all of the bells and whistles. Various
  1267.      standards such as POSIX.1 are supported, allowing software  written  for
  1268.      Linux  to  be easily ported to other systems. Professional UNIX program¡
  1269.      mers and system administrators can use  Linux  to  develop  software  at
  1270.      home,  and  then transfer the software to UNIX systems at work. This not
  1271.      only can save a great deal of time and money, but will also let you work
  1272.      in  the  comfort  of your own home, on a single-user system.(3) Computer
  1273.      Science students can use Linux to learn UNIX programming and to  explore
  1274.      other aspects of the system, such as kernel architechture.
  1275.  
  1276.  
  1277.           With  Linux,  not  only  do  you have access to the complete set of
  1278.      libraries and programming utilities, but you also have the complete ker¡
  1279.      nel  and  library source code at your fingertips. (Just imagine the end¡
  1280.      less mischief arising there!)
  1281.  
  1282.  
  1283.      2.4.4  The X Window System
  1284.  
  1285.      The X  Window  System  is  the  standard  graphics  interface  for  UNIX
  1286.      machines.  It  is  a  powerful environment supporting many applications.
  1287.      Using X Windows, the user can have  multiple  terminal  windows  on  the
  1288.      screen  at once, each one containing a different login session. A point¡
  1289.      ing device such as a mouse is often used with the X interface,  although
  1290.      it isn't required.
  1291.  
  1292.  
  1293.           Many  X-specific  applications  have  been  written, such as games,
  1294.      graphics utilities, programming and  documentation  tools,  and  so  on.
  1295.      With  Linux and X, your system is a bona fide workstation.  Coupled with
  1296.      TCP/IP networking, you can even display X applications running on  other
  1297.      machines  on  your  Linux  display,  as  is  possible with other systems
  1298.  
  1299.      
  1300.  
  1301.      3. The  author  uses  his Linux system to develop and test X
  1302.         Windows applications  at  home,  which  can  be  directly
  1303.         compiled on workstations elsewhere.
  1304.  
  1305.                                 - 22 -
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.      running X.
  1316.  
  1317.  
  1318.           The X Window System was originally developed at MIT, and is  freely
  1319.      distributable.  However, may commercial vendors have distributed propri¡
  1320.      etary enhancements to the original X Windows software. The version of  X
  1321.      Windows  available  for  Linux is known as XFree86, a port of X11R5 made
  1322.      freely distributable for 80386-based UNIX systems such as Linux. XFree86
  1323.      supports a wide range of video hardware, including VGA, Super VGA, and a
  1324.      number of accelerated video adaptors. This is a complete distribution of
  1325.      the  X  Windows  software, containing the X server itself, many applica¡
  1326.      tions and utilities, programming libraries, and documentation.
  1327.  
  1328.  
  1329.           Standard X applications include xterm (a terminal emulator used for
  1330.      most  text-based  applications  within  an X window); xdm (the X Session
  1331.      Manager, which handles logins); xclock (a simple  clock  display);  xman
  1332.      (an  X-based  man page reader), and more. The many X applications avail¡
  1333.      able for Linux are too numerous to mention here, but  the  base  XFree86
  1334.      distribution  includes the ``standard'' applications found in the origi¡
  1335.      nal MIT release. Many others are available separately, and theoretically
  1336.      any  application  written  for  X  Windows  should compile cleanly under
  1337.      Linux.
  1338.  
  1339.  
  1340.           The look and feel of the X Windows interface  is  controlled  to  a
  1341.      large  extent  by the window manager. This friendly program is in charge
  1342.      of the placement of windows, the user interface for  resizing,  iconify¡
  1343.      ing, and moving windows, the appearance of window frames, and so on. The
  1344.      standard XFree86 distribution includes twm, the classic MIT window  man¡
  1345.      ager,  although more advanced window managers such as the Open Look Vir¡
  1346.      tual Window Manager (olvwm) are available as well.  One  window  manager
  1347.      that  is popular among Linux users is fvwm.  This is a small window man¡
  1348.      ager, requiring less than half of the memory used by twm. It provides  a
  1349.      3-D  appearance  for  windows,  as  well a virtual desktop---if the user
  1350.      moves the mouse to the edge of the screen, the entire desktop is shifted
  1351.      as  if the display were much larger than it actually is. fvwm is greatly
  1352.      customizable, and allows all functions to be accessed from the  keyboard
  1353.      as  well as the mouse. Many Linux distributions use fvwm as the standard
  1354.      window manager.
  1355.  
  1356.  
  1357.           The XFree86 distribution contains programming libraries and include
  1358.      files  for  those  wily  programmers who wish to develop X applications.
  1359.      Various widget sets, such as Athena, Open Look, and Xaw3D are supported.
  1360.      All  of  the  standard  fonts, bitmaps, man pages, and documentation are
  1361.      included.  PEX (a programming interface for 3-D graphics) is  also  sup¡
  1362.      ported.
  1363.  
  1364.  
  1365.           Many  X  applications  programmers use the proprietary Motif widget
  1366.      set for development.  Several  vendors  sell  single  and  multiple-user
  1367.      licenses  for  a binary version of Motif for Linux. Because Motif itself
  1368.      is relatively expensive, not many Linux users own it. However,  binaries
  1369.  
  1370.  
  1371.                                 - 23 -
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.      statically  linked with Motif routines may be freely distributed. There¡
  1382.      fore, if you write a program using  Motif  and  wish  to  distribute  it
  1383.      freely, you may provide a binary so that users without Motif can use the
  1384.      program.
  1385.  
  1386.  
  1387.           The only major caveats with X Windows are the hardware  and  memory
  1388.      requirements.   A  386  with 4 megabytes of RAM is capable of running X,
  1389.      but 8 megabytes or more of physical RAM are needed to  use  it  comfort¡
  1390.      ably.  A  faster  processor  is  nice to have as well, but having enough
  1391.      physical RAM is much more important.  In  addition,  to  achieve  really
  1392.      slick  video performance, an accelerated video card (such as a local bus
  1393.      S3-chipset card) is strongly recommended.  Performance ratings in excess
  1394.      of  140,000 xstones have been acheived with Linux and XFree86. With suf¡
  1395.      ficient hardware, you'll find that running X and Linux is  as  fast,  or
  1396.      faster, than running X on other UNIX workstations.
  1397.  
  1398.  
  1399.           In  Chapter  6. we'll discuss how to install and use X on your sys¡
  1400.      tem.
  1401.  
  1402.  
  1403.      2.4.5  Networking
  1404.  
  1405.      Interested in communicating with the world? Yes? No? Maybe?  Linux  sup¡
  1406.      ports  the two primary networking protocols for UNIX systems: TCP/IP and
  1407.      UUCP.  TCP/IP  (Transmission  Control  Protocol/Internet  Protocol,  for
  1408.      acronym  aficionados) is the set of networking paradigms that allow sys¡
  1409.      tems all over the world to communicate on a single network known as  the
  1410.      Internet.  With  Linux, TCP/IP, and a connection to the network, you can
  1411.      communicate with users and machines across the Internet  via  electronic
  1412.      mail,  USENET  news,  file  transfers with FTP, and more. There are many
  1413.      Linux systems currently on the Internet.
  1414.  
  1415.  
  1416.           Most TCP/IP networks use Ethernet as the  physical  network  trans¡
  1417.      port.   Linux  supports  many  popular Ethernet cards and interfaces for
  1418.      personal computers, including the D-Link  pocket  Ethernet  adaptor  for
  1419.      laptops.
  1420.  
  1421.  
  1422.           However,  because  not everyone has an Ethernet drop at home, Linux
  1423.      also supports SLIP (Serial Line Internet Protocol), which allows you  to
  1424.      connect  to the Internet via modem. In order to use SLIP, you'll need to
  1425.      have access to a SLIP server, a machine connected to the  network  which
  1426.      allows  dial-in  access.  Many  businesses and universities provide such
  1427.      SLIP servers. In fact, if your Linux system has an  Ethernet  connection
  1428.      as  well  as  a  modem,  you can configure it as a SLIP server for other
  1429.      hosts.
  1430.  
  1431.  
  1432.           NFS (Network File System) allows your system  to  seamlessly  share
  1433.      files  with  other machines on the network. FTP (File Transfer Protocol)
  1434.      allows you to transfer files between other machines. Other  applications
  1435.  
  1436.  
  1437.                                 - 24 -
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.      include  sendmail,  a  system  for sending and receiving electronic mail
  1448.      using the SMTP protocol; NNTP-based electronic news systems such  as  C-
  1449.      News and INN; telnet, rlogin, and rsh, which allow you to login and exe¡
  1450.      cute commands on other machines on the network; and finger, which allows
  1451.      you to get information on other Internet users. There are literally tons
  1452.      of TCP/IP-based applications and protocols out there.
  1453.  
  1454.  
  1455.           The full range of mail and news readers are  available  for  Linux,
  1456.      such  as  elm,  pine, rn, nn, and tin. Whatever your preference, you can
  1457.      configure your Linux system to send and receive electronic mail and news
  1458.      from all over the world.
  1459.  
  1460.  
  1461.           If  you have experience with TCP/IP applications on other UNIX sys¡
  1462.      tems, Linux will be very familiar to you. The system provides a standard
  1463.      socket programming interface, so virtually any program which uses TCP/IP
  1464.      can be ported to Linux. The Linux X server also supports TCP/IP,  allow¡
  1465.      ing  you  to display applications running on other systems on your Linux
  1466.      display.
  1467.  
  1468.  
  1469.           In Chapter 6. we'll discuss  configuration  and  setup  of  TCP/IP,
  1470.      including SLIP, for Linux.
  1471.  
  1472.  
  1473.           UUCP  (UNIX-to-UNIX  Copy)  is  an older mechanism used to transfer
  1474.      files, electronic mail, and electronic news between UNIX machines. Clas¡
  1475.      sically,  UUCP machines connected to each other over the phone lines via
  1476.      modem, but UUCP is able to transport over a TCP/IP network as  well.  If
  1477.      you  do  not  have  access to a TCP/IP network or a SLIP server, you can
  1478.      configure your system to send and  receive  files  and  electronic  mail
  1479.      using UUCP. See Chapter 6. for more information.
  1480.  
  1481.  
  1482.      2.4.6  Telecommunications and BBS software
  1483.  
  1484.      If you have a modem, you will be able to communicate with other machines
  1485.      using one of the telecommunications packages available for  Linux.  Many
  1486.      people  use telecommunications software to access bulletin board systems
  1487.      (BBSs), as well as commercial online  services  such  as  Prodigy,  Com¡
  1488.      puServe,  and  America On-Line. Other people use their modems to connect
  1489.      to a UNIX system at work or school. You can  even  use  your  modem  and
  1490.      Linux system to send and receive facsimiles. Telecommunications software
  1491.      under Linux is very similar to that found under MS-DOS or other  operat¡
  1492.      ing  systems. Anyone who has ever used a telecommunications package will
  1493.      find the Linux equivalent familiar.
  1494.  
  1495.  
  1496.           One of the most popular communications packages for Linux is Seyon,
  1497.      an  X  application  providing  a customizable, ergonomic interface, with
  1498.      built-in support for various file transfer  protocols  such  as  Kermit,
  1499.      ZModem,  and  so on. Other telecommunications programs include C-Kermit,
  1500.      pcomm, and minicom. These are similar to communications  programs  found
  1501.  
  1502.  
  1503.                                 - 25 -
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.      on other operating systems, and are quite easy to use.
  1514.  
  1515.  
  1516.           If  you  do not have access to a SLIP server (see the previous sec¡
  1517.      tion), you can use term to multiplex your serial line. term  will  allow
  1518.      you  to  open  multiple  login  sessions  over the modem connection to a
  1519.      remote machine.  term will also allow you to redirect X  client  connec¡
  1520.      tions  to  your local X server, through the serial line, allowing you to
  1521.      display remote X applications on your Linux  system.   Another  software
  1522.      package, KA9Q, implements a similar SLIP-like interface.
  1523.  
  1524.  
  1525.           Running  a  bulletin  board  system  (BBS) is a favorite hobby (and
  1526.      means of income) for many people. Linux supports a  wide  range  of  BBS
  1527.      software,  most  of  which  is  more powerful than what is available for
  1528.      other operating systems.  With a phone line, a modem, and Linux, you can
  1529.      turn  your system into a BBS, providing dial-in access to your system to
  1530.      users worldwide. BBS software for Linux includes XBBS and  the  UniBoard
  1531.      BBS packages.
  1532.  
  1533.  
  1534.           Most  BBS  software  locks  the user into a menu-based system where
  1535.      only certain functions and applications are available. An alternative to
  1536.      BBS  access  is  full  UNIX access, which would allow users to dial into
  1537.      your system and login as a regular user. While this would require a fair
  1538.      amount of maintenance on the part of the system administrator, it can be
  1539.      done, and providing public UNIX access from your  Linux  system  is  not
  1540.      difficult  to  do.   Along  with a TCP/IP network, you can provide elec¡
  1541.      tronic mail and news access to users on your system.
  1542.  
  1543.  
  1544.           If you do not have access to a TCP/IP network or UUCP  feed,  Linux
  1545.      will  also  allow you to communicate with a number of BBS networks, such
  1546.      as FidoNet, with which you can exchange electronic news and mail via the
  1547.      phone  line.  More  information  on  telecommunications and BBS software
  1548.      under Linux can be found in Chapter 6..
  1549.  
  1550.  
  1551.      2.4.7  Interfacing with MS-DOS
  1552.  
  1553.      Various utilities exist to interface with  the  (somewhat  perverse,  we
  1554.      admit) world of MS-DOS. The most well-known application is the Linux MS-
  1555.      DOS Emulator, which allows you to run many MS-DOS applications  directly
  1556.      from  Linux.  Although Linux and MS-DOS are completely different operat¡
  1557.      ing systems, the 80386 protected-mode environment allows  certain  tasks
  1558.      to  behave  as  if  they  were running in 8086-emulation mode, as MS-DOS
  1559.      applications do.
  1560.  
  1561.  
  1562.           The MS-DOS emulator is still under development,  yet  many  popular
  1563.      applications  run under it. Understandably, however, MS-DOS applications
  1564.      which use bizarre or esoteric features of the system may never  be  sup¡
  1565.      ported, because it is only an emulator. For example, you wouldn't expect
  1566.      to be able to run any programs which use 80386 protected-mode  features,
  1567.  
  1568.  
  1569.                                 - 26 -
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.      such as Microsoft Windows (in 386 enhanced mode, that is).
  1580.  
  1581.  
  1582.           Applications which run successfully under the Linux MS-DOS Emulator
  1583.      include 4DOS (a command  interpreter),  Foxpro  2.0,  Harvard  Graphics,
  1584.      MathCad,  Stacker  3.1,  Turbo  Assembler,  Turbo  C/C++,  Turbo Pascal,
  1585.      Microsoft Windows 3.0 (in real mode), and WordPerfect 5.1. Standard  MS-
  1586.      DOS commands and utilities (such as PKZIP, and so on) work with the emu¡
  1587.      lator as well.
  1588.  
  1589.  
  1590.           The MS-DOS Emulator is meant mostly as an ad hoc solution for those
  1591.      people  who  need  MS-DOS only for a few applications, but use Linux for
  1592.      everything else. It's not meant to be a complete implementation  of  MS-
  1593.      DOS.   Of  course,  if  the Emulator doesn't satisfy your needs, you can
  1594.      always run MS-DOS as well as Linux on the same system.  Using  the  LILO
  1595.      boot  loader,  you  can  specify  at boot time which operating system to
  1596.      start. Linux can coexist with other operating systems, such as OS/2,  as
  1597.      well.
  1598.  
  1599.  
  1600.           Linux  provides a seamless interface for transferring files between
  1601.      Linux and MS-DOS. You can mount an  MS-DOS  partition  or  floppy  under
  1602.      Linux, and directly access MS-DOS files as you would any other.
  1603.  
  1604.  
  1605.           Currently   under  development  is  a  project  known  as  WINE---a
  1606.      Microsoft Windows emulator for the X Window System  under  Linux.   Once
  1607.      WINE  is  complete,  users  will  be able to run MS-Windows applications
  1608.      directly from Linux. This is similar to  the  proprietary  WABI  Windows
  1609.      emulator  from  Sun  Microsystems.  At the time of this writing, WINE is
  1610.      still in the early stages of development, but the outlook is good.
  1611.  
  1612.  
  1613.           In Chapter 6. we'll talk  about  the  MS-DOS  tools  available  for
  1614.      Linux.
  1615.  
  1616.  
  1617.      2.4.8  Other applications
  1618.  
  1619.      A  host  of  miscellany is available for Linux, as one would expect from
  1620.      such a hodgepodge operating system.  Linux's primary focus is  currently
  1621.      for  personal UNIX computing, but this is rapidly changing. Business and
  1622.      scientific software is expanding, and commercial  software  vendors  are
  1623.      beginning to contribute to the growing pool of applications.
  1624.  
  1625.  
  1626.           Several  relational  databases  are  available for Linux, including
  1627.      Postgres, Ingres,  and  Mbase.  These  are  full-featured,  professional
  1628.      client/server database applications similar to those found on other UNIX
  1629.      platforms.  /rdb, a commercial database system, is available as well.
  1630.  
  1631.  
  1632.           Scientific computing applications include FELT  (a  finite  element
  1633.  
  1634.  
  1635.                                 - 27 -
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.      analysis  tool);  gnuplot  (a  plotting  and data analysis application);
  1646.      Octave (a symbolic mathematics package, similar to MATLAB);  xspread  (a
  1647.      spreadsheet  calculator);  xfractint,  an  X-based  port  of the popular
  1648.      Fractint fractal generator; xlispstat (a statistics package), and  more.
  1649.      Other  applications  include  Spice (a circuit design and analysis tool)
  1650.      and Khoros (an image/digital signal processing  and  visualization  sys¡
  1651.      tem).
  1652.  
  1653.  
  1654.           Of  course,  there are many more such applications which have been,
  1655.      and can be, ported to run on Linux. Whatever your field,  porting  UNIX-
  1656.      based  applications to Linux should be quite straightforward. Linux pro¡
  1657.      vides a complete UNIX programming interface, sufficient to serve as  the
  1658.      base for any scientific application.
  1659.  
  1660.  
  1661.           As  with any operating system, Linux has its share of games.  These
  1662.      include classic text-based dungeon games such as Nethack and Moria; MUDs
  1663.      (multi-user dungeons, which allow many users to interact in a text-based
  1664.      adventure) such as DikuMUD and TinyMUD; as well as a  slew  of  X  games
  1665.      such  as xtetris, netrek, and gnuchess. True, UNIX never has lent itself
  1666.      to the modern trend of dazzling shoot-em-up arcade games, but  you  know
  1667.      what they say: ``All work and no play makes Linux a dull toy.''
  1668.  
  1669.  
  1670.           For  audiophiles,  Linux  has  support  for various sound cards and
  1671.      related software, such as CDplayer (a program which can control a CD-ROM
  1672.      drive as a conventional CD player, surprisingly enough), MIDI sequencers
  1673.      and editors (allowing you to compose music for playback through  a  syn¡
  1674.      thesizer  or  other  MIDI-controlled  instrument), and sound editors for
  1675.      digitized sounds.
  1676.  
  1677.  
  1678.           Can't find the application you're looking for? The  Linux  Software
  1679.      Map,  described  in Appendix A, contains a list of many software pack¡
  1680.      ages which have been written and ported to Linux. While this list is far
  1681.      from  complete,  it  contains  a great deal of software.  Another way to
  1682.      find Linux applications is to look at the INDEX files found on Linux FTP
  1683.      sites,  if you have Internet access. Just by poking around you'll find a
  1684.      great deal of software just waiting to be played with.
  1685.  
  1686.  
  1687.           If you absolutely can't find what you need, you can always  attempt
  1688.      to port the application from another platform to Linux. Most freely dis¡
  1689.      tributable UNIX-based software will compile on Linux with few  problems.
  1690.      Or, if all else fails, you can write the application yourself. If it's a
  1691.      commercial application you're looking for, there may be a free ``clone''
  1692.      available.  Or,  you  can  encourage  the  software  company to consider
  1693.      releasing a Linux binary version.  Several  individuals  have  contacted
  1694.      software companies, asking them to port their applications to Linux, and
  1695.      have met with various degrees of success.
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.                                 - 28 -
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.      2.5  About Linux's Copyright
  1712.  
  1713.      Linux is covered by what is known as the GNU General Public License,  or
  1714.      GPL.  The  GPL  was  developed  for the GNU project by the Free Software
  1715.      Foundataion. It makes a number of provisions for  the  distribution  and
  1716.      modification  of  ``free  software''.  ``Free''  in this sense refers to
  1717.      freedom, not just cost. The GPL has always been subject to  misinterpre¡
  1718.      tation,  and  we  hope that this summary will help you to understand the
  1719.      extent and goals of the GPL and its effect on Linux. A complete copy  of
  1720.      the GPL is included in Appendix D.
  1721.  
  1722.  
  1723.           Originally,  Linus  Torvalds  released  Linux  under a license more
  1724.      restrictive than the GPL, which allowed the software to be  freely  dis¡
  1725.      tributed  and  modified,  but prevented any money changing hands for its
  1726.      distribution and use. On the other hand, the GPL allows people  to  sell
  1727.      and  make profit from free software, but does not allow them to restrict
  1728.      the right for others to distribute the software in any way.
  1729.  
  1730.  
  1731.           First, it should be explained that ``free software'' covered by the
  1732.      GPL  is  not  in  the  public domain. Public domain software is software
  1733.      which is not copyrighted, and is literally owned by the public. Software
  1734.      covered  by  the GPL, on the other hand, is copyrighted to the author or
  1735.      authors. This means that the software is protected by standard  interna¡
  1736.      tional  copyright  laws,  and that the author of the software is legally
  1737.      defined. Just because the software may be freely  distributed  does  not
  1738.      mean that it is in the public domain.
  1739.  
  1740.  
  1741.           GPL-licensed   software   is  also  not  ``shareware''.  Generally,
  1742.      ``shareware'' software is owned and copyrighted by the author,  but  the
  1743.      author  requires  users to send in money for its use after distribution.
  1744.      On the other hand, software covered by the GPL may  be  distributed  and
  1745.      used free of charge.
  1746.  
  1747.  
  1748.           The  GPL  also  allows people to take and modify free software, and
  1749.      distribute their own versions of  the  software.  However,  any  derived
  1750.      works from GPL software must also be covered by the GPL. In other words,
  1751.      a company could not take Linux, modify it, and sell it under a  restric¡
  1752.      tive  license. If any software is derived from Linux, that software must
  1753.      be covered by the GPL as well.
  1754.  
  1755.  
  1756.           The GPL allows free software to be distributed  and  used  free  of
  1757.      charge.   However, it also allows a person or organization to distribute
  1758.      GPL software for a fee, and even to make a profit from its sale and dis¡
  1759.      tribution. However, in selling GPL software, the distributor cannot take
  1760.      those rights away from the purchaser; that is, if you purchase GPL soft¡
  1761.      ware from some source, you may distribute the software for free, or sell
  1762.      it yourself as well.
  1763.  
  1764.  
  1765.  
  1766.  
  1767.                                 - 29 -
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.           This might sound like a contradiction at first. Why  sell  software
  1778.      for profit when the GPL allows anyone to obtain it for free? As an exam¡
  1779.      ple, let's say that some company decided to bundle  a  large  amount  of
  1780.      free  software on a CD-ROM and distribute it. That company would need to
  1781.      charge for the overhead of producing and distributing  the  CD-ROM,  and
  1782.      the  company  may even decide to make profit from the sales of software.
  1783.      This is allowed by the GPL.
  1784.  
  1785.  
  1786.           Organizations which sell free software must follow certain restric¡
  1787.      tions  set  forth  in the GPL. First, they cannot restrict the rights of
  1788.      users who purchase the software. This means that if you buy a CD-ROM  of
  1789.      GPL software, you can copy and distribute that CD-ROM free of charge, or
  1790.      resell it yourself.  Secondly, distributors  must  make  it  obvious  to
  1791.      users that the software is indeed covered by the GPL. Thirdly, distribu¡
  1792.      tors must provide, free of charge, the  complete  source  code  for  the
  1793.      software  being  distributed.  This  will allow anyone who purchases GPL
  1794.      software to make modifications of that software.
  1795.  
  1796.  
  1797.           Allowing a company to distribute and sell free software is  a  very
  1798.      good  thing.   Not everyone has access to the Internet to download soft¡
  1799.      ware, such as Linux, for free. The GPL allows companies to sell and dis¡
  1800.      tribute software to those people who do not have free (cost-wise) access
  1801.      to  the  software.   For  example,  many  organizations  sell  Linux  on
  1802.      diskette,  tape,  or  CD-ROM  via mail order, and make profit from these
  1803.      sales. The developers of Linux may never see any of this profit; that is
  1804.      the understanding that is reached between the developer and the distrib¡
  1805.      utor when software is licensed by the GPL. In other  words,  Linus  knew
  1806.      that  companies  may wish to sell Linux, and that he may not see a penny
  1807.      of the profits from those sales.
  1808.  
  1809.  
  1810.           In the free software world, the important issue is not money.   The
  1811.      goal  of  free  software  is  always to develop and distribute fantastic
  1812.      software and to allow anyone to obtain and use it.  In the next section,
  1813.      we'll discuss how this applies to the development of Linux.
  1814.  
  1815.  
  1816.      2.6  The Design and Philosophy of Linux
  1817.  
  1818.      When new users encounter Linux, they often have a few misconceptions and
  1819.      false expectations of the system. Linux is a  unique  operating  system,
  1820.      and  it is important to understand its philosophy and design in order to
  1821.      use it effectively.  Time enough for a soapbox. Even if you are an  aged
  1822.      UNIX guru, what follows is probably of interest to you.
  1823.  
  1824.  
  1825.           In  commercial UNIX development houses, the entire system is devel¡
  1826.      oped with a rigorous policy of quality assurance,  source  and  revision
  1827.      control systems, documentation, and bug reporting and resolution. Devel¡
  1828.      opers are not allowed to add features or to change key sections of  code
  1829.      on  a  whim: they must validate the change as a response to a bug report
  1830.      and consequently ``check in'' all changes to the source control  system,
  1831.  
  1832.  
  1833.                                 - 30 -
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.      so  that  the  changes can be backed out if necessary. Each developer is
  1844.      assigned one or more parts of the system code, and only  that  developer
  1845.      may alter those sections of the code while it is ``checked out''.
  1846.  
  1847.  
  1848.           Internally,  the quality assurance department runs rigorous regres¡
  1849.      sion test suites on each new pass of the operating system,  and  reports
  1850.      any  bugs.  It is the responsibility of the developers to fix these bugs
  1851.      as reported.  A complicated system of statistical analysis  is  employed
  1852.      to  ensure  that  a certain percentage of bugs are fixed before the next
  1853.      release, and that the operating system as a whole passes certain release
  1854.      criteria.
  1855.  
  1856.  
  1857.           In  all, the process used by commercial UNIX developers to maintain
  1858.      and support their code is very complicated,  and  quite  reasonably  so.
  1859.      The  company  must  have  quantative proof that the next revision of the
  1860.      operating system is ready to be shipped; hence, the gathering and analy¡
  1861.      sis  of statistics about the operating system's performance. It is a big
  1862.      job to develop a commercial UNIX system, often large  enough  to  employ
  1863.      hundreds  (if  not  thousands) of programmers, testers, documentors, and
  1864.      administrative personel. Of course, no two commercial UNIX  vendors  are
  1865.      alike, but you get the general picture.
  1866.  
  1867.  
  1868.           With  Linux,  you  can  throw  out  the entire concept of organized
  1869.      development, source control systems, structured bug reporting,  or  sta¡
  1870.      tistical  analysis.   Linux  is,  and more than likely always will be, a
  1871.      hacker's operating system.(4)
  1872.  
  1873.  
  1874.           Linux is primarily developed as a group effort by volunteers on the
  1875.      Internet  from all over the world.  Across the Internet and beyond, any¡
  1876.      one with enough know-how has the opportunity to aid  in  developing  and
  1877.      debugging  the  kernel,  porting new software, writing documentation, or
  1878.      helping new users. There  is  no  single  organization  responsible  for
  1879.      developing  the  system. For the most part, the Linux community communi¡
  1880.      cates via various mailing lists and USENET newsgroups. A number of  con¡
  1881.      ventions have sprung up around the development effort: for example, any¡
  1882.      one wishing to have their  code  included  in  the  ``official''  kernel
  1883.      should  mail it to Linus Torvalds, which he will test and include in the
  1884.      kernel (as long as it doesn't break things or  go  against  the  overall
  1885.      design of the system, he will more than likely include it).
  1886.  
  1887.  
  1888.           The  system  itself  is  designed  with a very open-ended, feature-
  1889.      minded approach. While recently the number of new features and  critical
  1890.      changes  to  the  system have diminished, the general rule is that a new
  1891.  
  1892.      
  1893.  
  1894.      4. What I mean  by  ``hacker''  is  a  feverishly  dedicated
  1895.         programmer,  a person who enjoys exploiting computers and
  1896.         generally doing interesting things with them. This is  in
  1897.         contrast  to  the  common  denotation  of ``hacker'' as a
  1898.         computer wrongdoer or outlaw.
  1899.  
  1900.                                 - 31 -
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.      version of the kernel will be released about every few months (sometimes
  1911.      even  more  frequently than this).  Of course, this is a very rough fig¡
  1912.      ure: it depends on a several factors including the number of bugs to  be
  1913.      fixed, the amount of feedback from users testing pre-release versions of
  1914.      the code, and the amount of sleep that Linus has had this week.
  1915.  
  1916.  
  1917.           Let it suffice to say that not every single bug has been fixed, and
  1918.      not  every  problem  ironed out between releases.  As long as the system
  1919.      appears to be free of critical or oft-manifesting bugs, it is considered
  1920.      ``stable''  and  new  revisions will be released. The thust behind Linux
  1921.      development is not an effort to release perfect, bug-free code: it is to
  1922.      develop a free implementation of UNIX. Linux is for the developers, more
  1923.      than anyone else.
  1924.  
  1925.  
  1926.           Anyone who has a new feature or software application to add to  the
  1927.      system  generally  makes it available in an ``alpha'' stage---that is, a
  1928.      stage for testing by those brave or unwary users who want  to  bash  out
  1929.      problems  with  the initial code. Because the Linux community is largely
  1930.      based on the Internet, alpha software is usually uploaded to one or more
  1931.      of  the  various Linux FTP sites (see Appendix C) and a message posted
  1932.      to one of the Linux USENET newsgroups about how  to  get  and  test  the
  1933.      code.  Users who download and test alpha software can then mail results,
  1934.      bug fixes, or questions to the author.
  1935.  
  1936.  
  1937.           After the initial problems in the alpha code have been  fixed,  the
  1938.      code  enters  a ``beta'' stage, in which it is usually considered stable
  1939.      but not complete (that is, it works, but not all of the features may  be
  1940.      present).  Otherwise,  it  may go directly to a ``final'' stage in which
  1941.      the software is considered complete and usable. For kernel code, once it
  1942.      is  complete  the  developer may ask Linus to include it in the standard
  1943.      kernel, or as an optional add-on feature to the kernel.
  1944.  
  1945.  
  1946.           Keep in mind that these are only conventions---not rules. Some peo¡
  1947.      ple  feel  so  confident  with  their  software  that they don't need to
  1948.      release an alpha or test version. It is always up to  the  developer  to
  1949.      make these decisions.
  1950.  
  1951.  
  1952.           You might be amazed that such a nonstructured system of volunteers,
  1953.      programming and debugging a complete UNIX  system,  could  get  anything
  1954.      done  at all. As it turns out, it is one of the most efficient and moti¡
  1955.      vated development efforts ever employed. The  entire  Linux  kernel  was
  1956.      written  from  scratch,  without  employing  any  code  from proprietary
  1957.      sources. A great deal of work was put forth by volunteers to port all of
  1958.      the  free  software  under  the  sun to the Linux system. Libraries were
  1959.      written and ported, filesystems developed, and hardware drivers  written
  1960.      for many popular devices.
  1961.  
  1962.  
  1963.           The  Linux  software is generally released as a distribution, which
  1964.  
  1965.  
  1966.                                 - 32 -
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.      is a set of pre-packaged software making up an entire system.  It  would
  1977.      be  quite  difficult  for most users to build a complete system from the
  1978.      ground up, starting with the kernel, adding  utilities,  and  installing
  1979.      all  of  the  necessary software by hand. Instead, there are a number of
  1980.      software distributions including everything that you need to install and
  1981.      run  a complete system. Again, there is no standard distribution---there
  1982.      are many, each with their own advantages and disadvantages.  We'll  talk
  1983.      more about the various available Linux distributions in Section 3.1.
  1984.  
  1985.  
  1986.           Despite the completeness of the Linux software, you will still need
  1987.      a bit of UNIX know-how to install and run a complete system. No  distri¡
  1988.      bution  of  Linux  is completely bug-free, so you may be required to fix
  1989.      small problems by hand after installation. Running a UNIX system is  not
  1990.      an easy task, not even for commercial versions of UNIX.  If you're seri¡
  1991.      ous about Linux, bear in mind that it will take a considerable amount of
  1992.      effort  and  attention  on your part to keep the system running and take
  1993.      care of things: this is true of any UNIX system, and Linux is no  excep¡
  1994.      tion. Because of the diversity of the Linux community and the many needs
  1995.      which the software is attempting to meet, not  eveything  can  be  taken
  1996.      care of for you all of the time.
  1997.  
  1998.  
  1999.      2.6.1  Hints for UNIX novices
  2000.  
  2001.      One  of the greatest mistakes often made by new UNIX users is attempting
  2002.      to install and run a complete Linux system without much background  UNIX
  2003.      knowledge.   To   put  it  simply,  without  previous  UNIX  experience,
  2004.      installing and running Linux is going to prove difficult at  best.  This
  2005.      is  the  case  with all implementations of UNIX. Nobody can expect to go
  2006.      from being a UNIX novice to a UNIX system administrator  overnight.  Too
  2007.      much of the time, MS-DOS users are tempted to dive into the Linux world,
  2008.      expecting that it will be easy to pick up ``as you  go  along''  without
  2009.      any  external  help.  As  the  expression goes, ``This isn't Kansas any¡
  2010.      more.'' UNIX is not like MS-DOS or Microsoft Windows. No  implementation
  2011.      of  UNIX  is  expected  to run trouble- and maintenance-free. Every UNIX
  2012.      system needs a system administrator, and if you are the system  adminis¡
  2013.      trator  for  your soon-to-be-Linux system, you need to learn quite a few
  2014.      things about using and running UNIX before you begin.
  2015.  
  2016.  
  2017.           This may sound like a tall order, but it really isn't so bad. There
  2018.      are  many  good  introductory UNIX books on the market: See Appendix A
  2019.      for a list. Many new UNIX users expect to  install  Linux  in  order  to
  2020.      learn  UNIX,  but  we're afraid that it's supposed to work the other way
  2021.      around. Installing and setting up a UNIX system of your own is  a  chal¡
  2022.      lenging  task  even  for very experienced system administrators. This is
  2023.      not to say that it is difficult, but only that you will benefit  greatly
  2024.      from  UNIX  experience  and  an understanding of the process. Should you
  2025.      have trouble installing the system, you will know how to investigate and
  2026.      fix  the  problem yourself without having to find outside help. You must
  2027.      be aptly prepared for the journey which lies ahead. Otherwise, if you're
  2028.      new to UNIX, you may very well become overly frustrated with the system.
  2029.      It is very important to do some reading and  experimentation  with  UNIX
  2030.  
  2031.  
  2032.                                 - 33 -
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.      systems before attempting to run your own Linux system.
  2043.  
  2044.  
  2045.      2.6.2  Hints for UNIX gurus
  2046.  
  2047.      Even those people with years of UNIX programming and systems administra¡
  2048.      tion experience may need assitance before they are able to pick  up  and
  2049.      install  Linux.  There are still aspects of the system that UNIX wizards
  2050.      will need to be familiar with before diving in. For one thing, Linux  is
  2051.      not  a  commercial  UNIX  system. It does not attempt to uphold the same
  2052.      standards as other UNIX systems you have may have  come  across.  To  be
  2053.      more specific, while stability is an important factor in the development
  2054.      of Linux, it is not the only factor.
  2055.  
  2056.  
  2057.           More important, perhaps, is functionality.  In many cases, new code
  2058.      will  make it into the standard kernel even though it is still buggy and
  2059.      not functionally complete. The assumption is that it is  more  important
  2060.      to  release code which users can test and use than delay a release until
  2061.      it is ``complete''. As an example, WINE (the Microsoft Windows  Emulator
  2062.      for  Linux)  had  an ``official'' alpha release before it was completely
  2063.      tested. In this way, the Linux community at large had a chance  to  work
  2064.      with  the  code, test it, and help develop it, while those who found the
  2065.      alpha code ``good enough'' for their needs could use it. Commercial UNIX
  2066.      vendors rarely, if ever, release software in this manner.
  2067.  
  2068.  
  2069.           If  you  have  been  a  UNIX  systems administrator for more than a
  2070.      decade, and have used every commercial UNIX system under the Sun (no pun
  2071.      intended),  Linux may take some getting used to. The system is very mod¡
  2072.      ern and dynamic.  A new kernel release is made approximately  every  few
  2073.      months.   New software is constantly being released. One day your system
  2074.      may be completely up-to-date with the current trend, and  the  next  day
  2075.      the same system is considered to be in the Stone Age.
  2076.  
  2077.  
  2078.           With  all of this dynamic activity, how can you be expected to keep
  2079.      up with the ever-changing Linux world?  For the most part, it is best to
  2080.      upgrade  incrementally;  that is, upgrade only those parts of the system
  2081.      that need upgrading, and then only when you think an upgrade  is  neces¡
  2082.      sary.  For  example,  if  you never use Emacs, there is little reason to
  2083.      continuously install every new release of Emacs on your system. Further¡
  2084.      more,  even if you are an avid Emacs user, there is usually no reason to
  2085.      upgrade it unless you find that some feature is missing that is  in  the
  2086.      next  release.  There  is little or no reason to always be on top of the
  2087.      newest version of software.
  2088.  
  2089.  
  2090.           We hope that Linux will meet or exceed your expectations of a home¡
  2091.      brew  UNIX system. At the very core of Linux is the spirit of free soft¡
  2092.      ware, of constant development and growth.  The  Linux  community  favors
  2093.      expansion over stability, and that is a difficult concept to swallow for
  2094.      many people, especially those so steeped  in  the  world  of  commercial
  2095.      UNIX. You cannot expect Linux to be perfect; nothing ever is in the free
  2096.  
  2097.  
  2098.                                 - 34 -
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.      software world.  However, we believe that Linux really  is  as  complete
  2109.      and useful as any other implementation of UNIX.
  2110.  
  2111.  
  2112.      2.7  Differences Between Linux and Other Operating Systems
  2113.  
  2114.      It  is  important  to understand the differences between Linux and other
  2115.      operating systems, such as MS-DOS, OS/2, and  other  implementations  of
  2116.      UNIX  for  the  personal computer. First of all, it should be made clear
  2117.      that Linux will coexist happily with other operating systems on the same
  2118.      machine:  that  is,  you can run MS-DOS and OS/2 along with Linux on the
  2119.      same system without problems.  There are even ways to  interact  between
  2120.      the various operating systems, as we'll see.
  2121.  
  2122.  
  2123.      2.7.1  Why use Linux?
  2124.  
  2125.      Why  use Linux instead of a well-known, well-tested, and well-documented
  2126.      commercial operating system? We could give you a thousand  reasons.  One
  2127.      of the most important, however, is that Linux is an excellent choice for
  2128.      personal UNIX computing. If you're a UNIX software  developer,  why  use
  2129.      MS-DOS  at  home? Linux will allow you to develop and test UNIX software
  2130.      on your PC, including database and X Windows applications.  If you're  a
  2131.      student,  chances  are  that your university computing systems run UNIX.
  2132.      With Linux, you can run your own UNIX system and tailor it to  your  own
  2133.      needs.  Installing  and  running Linux is also an excellent way to learn
  2134.      UNIX if you don't have access to other UNIX machines.
  2135.  
  2136.  
  2137.           But let's not lose sight. Linux isn't just for personal UNIX users.
  2138.      It  is robust and complete enough to handle large tasks, as well as dis¡
  2139.      tributed computing needs. Many businesses---especially small  ones---are
  2140.      moving  to  Linux  in lieu of other UNIX-based workstation environments.
  2141.      Universities are finding Linux to be perfect  for  teaching  courses  in
  2142.      operating  systems design. Larger commercial software vendors are start¡
  2143.      ing to realize the opportunities that a free operating system  can  pro¡
  2144.      vide.
  2145.  
  2146.  
  2147.           The  following sections should point out the most important differ¡
  2148.      ences between Linux and other operating systems.  We  hope  that  you'll
  2149.      find  that  Linux  can  meet your computing needs, or (at least) enhance     your current computing environment. Keep in mind that they best  way  to
  2150.      get a taste for Linux is just to try it out---you needn't even install a
  2151.      complete system to get a feel for it. In Chapter 3., we'll show you how.
  2152.  
  2153.  
  2154.      2.7.2  Linux vs. MS-DOS
  2155.  
  2156.      It's not uncommon to run both Linux and MS-DOS on the same system.  Many
  2157.      Linux users rely on MS-DOS for applications  such  as  word  processing.
  2158.      While Linux provides its own analogues for these applications (for exam¡
  2159.      ple, TeX), there are various reasons why a particular user would want to
  2160.      run  MS-DOS  as  well  as Linux.  If your entire dissertation is written
  2161.  
  2162.  
  2163.                                 - 35 -
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.      using WordPerfect for MS-DOS, you may not be able to easily  convert  it
  2174.      to  TeX or some other format. There are many commercial applications for
  2175.      MS-DOS which aren't available for Linux, and there's no reason  why  you
  2176.      can't use both.
  2177.  
  2178.  
  2179.           As  you might know, MS-DOS does not fully utilize the functionality
  2180.      of the 80386 and 80486 processors. On the other hand,  Linux  runs  com¡
  2181.      pletely  in the processor's protected mode, and exploits all of the fea¡
  2182.      tures of the processor. You can directly access all  of  your  available
  2183.      memory  (and  beyond, using virtual RAM). Linux provides a complete UNIX
  2184.      interface not  available  under  MS-DOS---developing  and  porting  UNIX
  2185.      applications under Linux is easily done, while under MS-DOS you are lim¡
  2186.      ited to a small subset of the UNIX programming  functionality.   Because
  2187.      Linux is a true UNIX system, you do not have these limitations.
  2188.  
  2189.  
  2190.           We  could debate the pros and cons of MS-DOS and Linux for pages on
  2191.      end.  However, let it suffice to say that  Linux  and  MS-DOS  are  com¡
  2192.      pletely  different  entities.  MS-DOS  is inexpensive (compared to other
  2193.      commerical operating systems), and has a strong foothold in the PC  com¡
  2194.      puting  world.  support the system. No other operating system for the PC
  2195.      has reached the level of popularity of MS-DOS---largely because the cost
  2196.      of these other operating systems is unapproachable to most personal com¡
  2197.      puter users. Very few PC users can imagine spending $1000 or more on the
  2198.      operating  system  alone.  Linux, however, is free, and you finally have
  2199.      the chance to decide.
  2200.  
  2201.  
  2202.           We will allow you to make your own judgments of  Linux  and  MS-DOS
  2203.      based on your expectations and needs. Linux is not for everybody. If you
  2204.      have always wanted to run a complete UNIX system at  home,  without  the
  2205.      high  cost  of  other UNIX implementations for the PC, Linux may be what
  2206.      you're looking for.
  2207.  
  2208.  
  2209.           There are tools available to allow you to  interact  between  Linux
  2210.      and  MS-DOS.  For example, it is easy to access MS-DOS files from Linux.
  2211.      There is also an MS-DOS emulator available, which allows you to run many
  2212.      popular  MS-DOS  applications. A Microsoft Windows emulator is currently
  2213.      under development.
  2214.  
  2215.  
  2216.      2.7.3  Linux vs. The Other Guys
  2217.  
  2218.      A number of other advanced operating systems are on the rise in  the  PC
  2219.      world.  Specifically, IBM's OS/2 and Microsoft's Windows NT are becoming
  2220.      very popular as more users move away from MS-DOS.
  2221.  
  2222.  
  2223.           Both OS/2 and Windows NT are full multitasking  operating  systems,
  2224.      much like Linux. Technically, OS/2, Windows NT, and Linux are quite sim¡
  2225.      ilar: they support roughly the same features in terms of user interface,
  2226.      networking, security, and so forth. However, the real difference between
  2227.  
  2228.  
  2229.                                 - 36 -
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.      Linux and The Other Guys is the fact that Linux is a  version  of  UNIX,
  2240.      and  hence  benefits  from  the  contributions  of the UNIX community at
  2241.      large.
  2242.  
  2243.  
  2244.           What makes UNIX so important? Not only is it the most popular oper¡
  2245.      ating  system  for multiuser machines, it is also the foundation for the
  2246.      majority of the free software world. If you have access to the Internet,
  2247.      nearly  all of the free software available there is written specifically
  2248.      for UNIX systems. (The Internet itself is largely UNIX-based.)
  2249.  
  2250.  
  2251.           There are many implementations of UNIX, from many vendors,  and  no
  2252.      single  organization  is responsible for distribution.  There is a large
  2253.      push in the UNIX community for standardization in the form of open  sys¡
  2254.      tems, but no single corporation controls this design.  Hence, any vendor
  2255.      (or, as it turns out, any hacker) may implement these  standards  in  an
  2256.      implementation of UNIX.
  2257.  
  2258.  
  2259.           OS/2  and  Windows  NT, on the other hand, are proprietary systems.
  2260.      The interface and design are controlled by  a  single  corporation,  and
  2261.      only  that corporation may implement that design. (Don't expect to see a
  2262.      free version of OS/2 anytime in the near future.)  In  one  sense,  this
  2263.      kind  of  organization  is beneficial: it sets a strict standard for the
  2264.      programming and user interface unlike that found even in the  open  sys¡
  2265.      tems  community.  OS/2 is OS/2 wherever you go---the same holds for Win¡
  2266.      dows NT.
  2267.  
  2268.  
  2269.           However, the UNIX interface is constantly developing and  changing.
  2270.      Several  organizations  are  attempting  to  standardize the programming
  2271.      model, but the task is very difficult. Linux, in particular,  is  mostly
  2272.      compliant  with the POSIX.1 standard for the UNIX programming interface.
  2273.      As time goes on, it is expected that the system  will  adhere  to  other
  2274.      such  standards,  but  standardization  is  not the primary issue in the
  2275.      Linux development community.
  2276.  
  2277.  
  2278.      2.7.4  Other implementations of UNIX
  2279.  
  2280.      There are several other implementations of UNIX for the 80386 and 80486.
  2281.      The 80386 architechture lends itself to the UNIX design, and a number of
  2282.      vendors have taken advantage of this.
  2283.  
  2284.  
  2285.           Feature-wise, other implementations of UNIX for the  PC  are  quite
  2286.      similar  to  Linux.  You will see that almost all commercial versions of
  2287.      UNIX support roughly the same  software,  programming  environment,  and
  2288.      networking features.  However, there are some strong differences between
  2289.      Linux and commercial versions of UNIX.
  2290.  
  2291.  
  2292.           First of all, Linux supports a different  range  of  hardware  from
  2293.  
  2294.  
  2295.                                 - 37 -
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.      commercial  implementations.  In  general, Linux supports the most well-
  2306.      known hardware devices, but support is still limited  to  that  hardware
  2307.      which developers actually have access to.  However, Commercial UNIX ven¡
  2308.      dors generally have a wider support base, and tend to support more hard¡
  2309.      ware,  although  Linux  is  not  far  behind.   We'll cover the hardware
  2310.      requirements for Linux in Section 2.8.
  2311.  
  2312.  
  2313.           Secondly, commercial implementations of UNIX usually  come  bundled
  2314.      with  a  complete  set of documentation as well as user support from the
  2315.      vendor. In contrast, most of the documentation for Linux is  limited  to
  2316.      documents  available  on  the  Internet---and books such as this one. In
  2317.      Section 2.9 we'll list sources of Linux documentation and other informa¡
  2318.      tion.
  2319.  
  2320.  
  2321.           As  far  as stability and robustness are concerned, many users have
  2322.      reported that Linux is at least as stable as  commercial  UNIX  systems.
  2323.      Linux is still under development, and certain features (such TCP/IP net¡
  2324.      working) are less stable but improve as time goes by.
  2325.  
  2326.  
  2327.           The most important factor to consider for many users is price.  The
  2328.      Linux  software  is free, if you have access to the Internet (or another
  2329.      computer network) and can download it. If you do not have access to such
  2330.      a network, you may need to purchase it via mail order on diskette, tape,
  2331.      or CD-ROM (see Appendix B).  Of course, you  may  copy  Linux  from  a
  2332.      friend  who may already have the software, or share the cost of purchas¡
  2333.      ing it with someone else. If you are planning  to  install  Linux  on  a
  2334.      large  number  of  machines, you need only purchase a single copy of the
  2335.      software---Linux is not distributed on a ``single machine'' license.
  2336.  
  2337.  
  2338.           The  value  of  commercial  UNIX  implementations  should  not   be
  2339.      demeaned:  along with the price of the software itself, one usually pays
  2340.      for documentation, support, and assurance of  quality.  These  are  very
  2341.      important  factors  for  large institutions, but personal computer users
  2342.      may not require these benefits. In any case, many businesses and univer¡
  2343.      sities  are  finding that running Linux on a lab of inexpensive personal
  2344.      computers is preferrable to running a commercial version of  UNIX  in  a
  2345.      lab  of  workstations. Linux can provide the functionality of a worksta¡
  2346.      tion on PC hardware at a fraction of the cost.
  2347.  
  2348.  
  2349.           As a ``real-world'' example of Linux's  use  within  the  computing
  2350.      community,  Linux  systems  have  travelled  the  high seas of the North
  2351.      Pacific, managing telecommunications and data analysis  for  an  oceano¡
  2352.      graphic  research vessel.  Linux systems are being used at research sta¡
  2353.      tions in Antarctia. As a more mundane example, perhaps,  several  hospi¡
  2354.      tals are using Linux to maintain patient records. It is proving to be as
  2355.      reliable and useful as other implementations of UNIX.
  2356.  
  2357.  
  2358.           There are other free or inexpensive implementations of UNIX for the
  2359.  
  2360.  
  2361.                                 - 38 -
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.      386  and  486.  One  of  the  most  well-known is 386BSD (often known as
  2372.      ``NetBSD''), an implementation and port of BSD UNIX for the 386.  386BSD
  2373.      is comparable to Linux in many ways, but which one is ``better'' depends
  2374.      on your own personal needs and expectations.  The only  strong  distinc¡
  2375.      tion  that we can make is that Linux is developed openly (where any vol¡
  2376.      unteer can aid in the development process), while  386BSD  is  developed
  2377.      within  a closed team of programmers who maintain the system. Because of
  2378.      this, serious philosophical and design differences exist between the two
  2379.      projects. The goals of the two projects are entirely different: the goal
  2380.      of Linux is to develop a complete UNIX system from scratch (and  have  a
  2381.      lot  of fun in the process), and the goal of 386BSD is in part to modify
  2382.      the existing BSD code for use on the 386.
  2383.  
  2384.  
  2385.           Another project of note is HURD, an effort  by  the  Free  Software
  2386.      Foundation  to  develop  and  distribute a free version of UNIX for many
  2387.      platforms. Contact the Free Software Foundation (the address is given in
  2388.      Appendix  D)  for more information about this project.  At the time of
  2389.      this writing, HURD is still in early stages of development.
  2390.  
  2391.  
  2392.           Other inexpensive versions of UNIX exist as well, such as  Coherent
  2393.      (available  for  about $99) and Minix (an academic but useful UNIX clone
  2394.      upon which early development of Linux was based). Some of  these  imple¡
  2395.      mentations  are  of  mostly  academic  interest,  while others are full-
  2396.      fledged systems for real productivity. Needless to  say,  however,  many
  2397.      personal UNIX users are moving to Linux.
  2398.  
  2399.  
  2400.      2.8  Hardware Requirements
  2401.  
  2402.      Now  you  must  be  convinced  of how wonderful Linux is, and all of the
  2403.      great things that it can do for you. However, before you  rush  out  and
  2404.      install  the software, you need to be aware of the hardware requirements
  2405.      and limitations that Linux has.
  2406.  
  2407.  
  2408.           Keep in mind that Linux was developed by its users. This means, for
  2409.      the most part, that the hardware which is supported by Linux is only the
  2410.      hardware which the users and developers actually have access to.  As  it
  2411.      turns  out, most of the popular hardware and peripherals for 80386/80486
  2412.      systems are supported (in fact, Linux supports more hardware  than  some
  2413.      commercial  implementations  of UNIX). However, some of the more obscure
  2414.      and esoteric of devices aren't supported yet. As time goes on,  a  wider
  2415.      range  of  hardware  is  supported,  so  if your favorite devices aren't
  2416.      listed here, chances are that support for them if forthcoming.
  2417.  
  2418.  
  2419.           Another drawback for hardware support under Linux is that many com¡
  2420.      panies  have  decided  to  keep  the hardware interface proprietary. The
  2421.      upshot of this is that volunteer Linux  developers  simply  can't  write
  2422.      drivers  for  those devices (if they could, those drivers would be owned
  2423.      by the company that owned the interface, which would violate  the  GPL).
  2424.      The  companies  that  maintain  proprietary  interfaces  write their own
  2425.  
  2426.  
  2427.                                 - 39 -
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.      drivers for operating systems such as MS-DOS and Microsoft Windows;  the
  2438.      end  user (that's you) never needs to know about the interface. Unfortu¡
  2439.      nately, this does not allow Linux developers to write drivers for  those
  2440.      devices.
  2441.  
  2442.  
  2443.           There  is very little that can be done about the situation. In some
  2444.      cases, programmers have attempted to  write  hackish  drivers  based  on
  2445.      assumptions  about  the  interface. In other cases, developers will work
  2446.      with the company in question and attempt to obtain information about the
  2447.      device interface, with varying degrees of success.
  2448.  
  2449.  
  2450.           In  the following sections, we'll attempt to summarize the hardware
  2451.      requirements for Linux. The Linux Hardware Compatibility List (see  Sec¡
  2452.      tion  2.9)  contains  a  more  complete listing of hardware supported by
  2453.      Linux.
  2454.  
  2455.  
  2456.           Disclaimer: a good deal of hardware support for Linux is  currently
  2457.      in  the  development  stage.  Some  distributions may or may not support
  2458.      these experimental features. This section primarily lists hardware which
  2459.      has  been  supported  for  some  time and is known to be stable. When in
  2460.      doubt, consult the documentation for the distribution of Linux  you  are
  2461.      using (see Section 3.1 for more information on Linux distributions).
  2462.  
  2463.  
  2464.      2.8.1  Motherboard and CPU requirements
  2465.  
  2466.      Linux currently supports systems with an Intel 80386 or 80486 CPU.  This
  2467.      includes all variations on this CPU type,  such  as  the  386SX,  486SX,
  2468.      486DX,  and  486DX2. Linux should also work on Intel's Pentium processor
  2469.      with minor changes. Non-Intel ``clones'', such as AMD and Cyrix  proces¡
  2470.      sors, work with Linux as well.
  2471.  
  2472.  
  2473.           If  you  have  a  80386 or 80486SX, you may also wish to use a math
  2474.      coprocessor, although one isn't required (the Linux kernel  can  do  FPU
  2475.      emulation  if you do not have a math coprocessor). All standard FPU cou¡
  2476.      plings are supported, such as IIT, Cyrix FasMath,  and  Intel  coproces¡
  2477.      sors.
  2478.  
  2479.  
  2480.           The system motherboard must use ISA or EISA bus architecture. There
  2481.      terms define how the system interfaces with peripherals and other compo¡
  2482.      nents  on  the  main bus. Most systems sold today are either ISA or EISA
  2483.      bus. IBM's MicroChannel (MCA) bus, found on machines  such  as  the  IBM
  2484.      PS/2, is not currently supported.
  2485.  
  2486.  
  2487.           Systems  which  use  a local bus architecture (for faster video and
  2488.      disk access) are supported as well. It is  suggested  that  you  have  a
  2489.      standard local bus architecture such as the VESA Local Bus (``VLB'').
  2490.  
  2491.  
  2492.  
  2493.                                 - 40 -
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.      2.8.2  Memory requirements
  2504.  
  2505.      Linux  requires  very  little  memory  to run compared to other advanced
  2506.      operating systems. You should have at the very least 2 megabytes of RAM;
  2507.      however,  it  is  strongly syggested that you have 4 megabytes. The more
  2508.      memory you have, the faster the system will run.
  2509.  
  2510.  
  2511.           Linux can support the full 32-bit address range of the 386/486;  in
  2512.      other words, it will utilize all of your RAM automatically.
  2513.  
  2514.  
  2515.           Linux  will run happily with only 4 megabytes of RAM, including all
  2516.      of the bells and whistles such as X Windows, Emacs, and so on.  However,
  2517.      having  more memory is almost as important as having a faster processor.
  2518.      8 megabytes is more than enough for personal use; 16 megabytes  or  more
  2519.      may be needed if you are expecting a heavy user load on the system.
  2520.  
  2521.  
  2522.           Most  Linux  users  allocate  a portion of their hard drive as swap
  2523.      space, which is used as virtual RAM. Even if you have a  great  deal  of
  2524.      physical RAM in your machine, you may wish to use swap space. While swap
  2525.      space is no replacement for actual physical RAM, it can allow your  sys¡
  2526.      tem to run larger applications by swapping out inactive portions of code
  2527.      to disk.  The amount of swap space that you should allocate  depends  on
  2528.      several factors; we'll come back to this question in Section 3.2.3.
  2529.  
  2530.  
  2531.      2.8.3  Hard drive controller requirements
  2532.  
  2533.      You do not need to have a hard drive to run Linux; you can run a minimal
  2534.      system completely from floppy. However, this is slow and  very  limited,
  2535.      and  many users have access to hard drive storage anyway.  You must have
  2536.      an AT-standard (16-bit) controller. There is support in  the  works  for
  2537.      XT-standard  (8  bit)  controllers; however, most controllers used today
  2538.      are AT-standard. Linux should support all MFM, RLL, ESDI, and  IDE  con¡
  2539.      trollers.
  2540.  
  2541.  
  2542.           The  general rule for non-SCSI hard drive and floppy controllers is
  2543.      that if you can access the drive from MS-DOS or another  operating  sys¡
  2544.      tem, you should be able to access it from Linux.
  2545.  
  2546.  
  2547.           Linux  also  supports  a  number of popular SCSI drive controllers,
  2548.      although support for SCSI is more limited because of the wide  range  of
  2549.      controller  interface  standards. Supported SCSI controllers include the
  2550.      Adaptec AHA1542B, AHA1742A (BIOS version 1.34), AHA1740, AHA1740 (SCSI-2
  2551.      controller,  BIOS  1.34  in Enhanced mode); Future Domain 1680, TMC-850,
  2552.      TMC-950; Seagate ST-02; UltraStor  SCSI;  Western  Digital  WD7000FASST.
  2553.      Clones which are based on these cards should work as well.
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.                                 - 41 -
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.      2.8.4  Hard drive space requirements
  2570.  
  2571.      Of  course,  to  install  Linux, you'll need to have some amount of free
  2572.      space on your hard drive. Linux will support multiple hard drives in the
  2573.      same machine; you can allocate space for Linux across multiple drives if
  2574.      necessary.
  2575.  
  2576.  
  2577.           The amount of hard  drive  space  that  you  will  require  depends
  2578.      greatly on your needs and the amount of software that you're installing.
  2579.      Linux is relatively small as UNIX implementations go; you  could  run  a
  2580.      complete  system  in 10 to 20 megabytes of space on your drive. However,
  2581.      if you want to have room for expansion, and for larger packages such  as
  2582.      X Windows, you will need more space. If you plan to allow multiple users
  2583.      to use the machine, you will need to allocate storage for their files.
  2584.  
  2585.  
  2586.           Also, unless you have a large amount of physical RAM (16  megabytes
  2587.      or  more),  you will more than likely want to allocate swap space, to be
  2588.      used as virtual RAM. We will discuss all of the  details  of  installing
  2589.      and using swap space in Section 3.2.3.
  2590.  
  2591.  
  2592.           Each  distribution of Linux usually comes with some literature that
  2593.      should help you to gauge the precise amount of required storage  depend¡
  2594.      ing on the amount of software you plan to install. You can run a minimal
  2595.      system with less than 20 megabytes; a complete system with  all  of  the
  2596.      bells and whistles in 80 megabytes or less; and a very large system with
  2597.      room for many users and space for  future  expansion  in  the  range  of
  2598.      100-150  megabytes.  Again,  these  figures are meant only as a ballpark
  2599.      approximation; you will have to look at your  own  needs  and  goals  in
  2600.      order to determine your specific storage requirements.
  2601.  
  2602.  
  2603.      2.8.5  Monitor and video adapator requirements
  2604.  
  2605.      Linux supports all standard Hercules, CGA, EGA, VGA, and Super VGA video
  2606.      cards and monitors for the default text-based interface. In general,  if
  2607.      the video card and monitor coupling works under another operating system
  2608.      such as MS-DOS, it should work fine with Linux.
  2609.  
  2610.  
  2611.           Graphical environments such as the X Window System have video hard¡
  2612.      ware  requirements  of  their own. Instead of listing these requirements
  2613.      here, we relegate the discussion to Section 6.1.1.
  2614.  
  2615.  
  2616.      2.8.6  Miscellaneous hardware
  2617.  
  2618.      The above sections described the hardware which is  required  to  run  a
  2619.      Linux  system. However, most users have a number of ``optional'' devices
  2620.      such as tape and CD-ROM storage, sound boards, and so on, and are inter¡
  2621.      ested in whether or not this hardware is supported by Linux. Read on.
  2622.  
  2623.  
  2624.  
  2625.                                 - 42 -
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.      2.8.6.1  Mice and other pointing devices
  2636.      For  the  most  part,  you  will only be using a mouse under a graphical
  2637.      environment such as the X Window System. However, several Linux applica¡
  2638.      tions  not  associated  with  a  graphics environment do make use of the
  2639.      mouse.
  2640.  
  2641.  
  2642.           Linux supports all standard serial  mice,  including  Logitech,  MM
  2643.      series,  Mouseman,  Microsoft  (2-button)  and Mouse Systems (3-button).
  2644.      Linux also supports Microsoft, Logitech, and  ATIXL  busmice.  The  PS/2
  2645.      mouse interface is supported as well.
  2646.  
  2647.  
  2648.           All  other  pointing devices, such as trackballs, which emulate the
  2649.      above mice, should work as well.
  2650.  
  2651.  
  2652.      2.8.6.2  CD-ROM storage
  2653.      Almost all CD-ROM drives use the SCSI interface. As long as you  have  a
  2654.      SCSI  adaptor supported by Linux, then your CD-ROM drive should work.  A
  2655.      number of CD-ROM drives have been verified to work under Linux,  includ¡
  2656.      ing  the  NEC CDR-74, Sony CDU-541, and Texel DM-3024. The Sony internal
  2657.      CDU-31a and the Mistsumi CD-ROM drives are supported by Linux as well.
  2658.  
  2659.  
  2660.           Linux supports the standard ISO-9660 filesystem for CD-ROMs.
  2661.  
  2662.  
  2663.      2.8.6.3  Tape drives
  2664.      There are several types of tape drives available on the market. Most  of
  2665.      them  use the SCSI interface, all of which should be supported by Linux.
  2666.      Among the verified SCSI tape drives are  the  Sankyo  CP150SE;  Tandberg
  2667.      3600;  Wangtek  5525ES,  5150ES, and 5099EN with the PC36 adaptor. Other
  2668.      QIC-02 drives should be supported as well.
  2669.  
  2670.  
  2671.           Drivers are currently under  development  for  various  other  tape
  2672.      devices,  such  as  Colorado  drives  which  hang off of the floppy con¡
  2673.      troller.
  2674.  
  2675.  
  2676.      2.8.6.4  Printers
  2677.      Linux supports the complete range of parallel printers. If you are  able
  2678.      to  access  your  printer  via  the parallel port from MS-DOS or another
  2679.      operating system, you should be a able to access it from Linux as  well.
  2680.      The  Linux  printing  software  consists of the UNIX standard lp and lpr
  2681.      software.  This software also allows you to print remotely via the  net¡
  2682.      work, if you have one available.
  2683.  
  2684.  
  2685.      2.8.6.5  Modems
  2686.      As with printer support, Linux supports the full range of serial modems,
  2687.      both internal and external. There is a great deal of  telecommunications
  2688.      software  available  for  Linux,  including  Kermit, pcomm, minicom, and
  2689.  
  2690.  
  2691.                                 - 43 -
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.      Seyon. If your modem is accessible from another operating system on  the
  2702.      same  machine, you should be able to access it from Linux with no diffi¡
  2703.      culty.
  2704.  
  2705.  
  2706.      2.8.7  Ethernet cards
  2707.  
  2708.      Many popular Ethernet cards and LAN adaptors  are  supported  by  Linux.
  2709.      These include:
  2710.  
  2711.  
  2712.              * 3com 3c503, 3c503/16
  2713.  
  2714.              * Novell NE1000, NE2000
  2715.  
  2716.              * Western Digital WD8003, WD8013
  2717.  
  2718.              * Hewlett Packard HP27245, HP27247, HP27250
  2719.  
  2720.      The following clones are reported to work:
  2721.  
  2722.  
  2723.              * LANNET LEC-45
  2724.  
  2725.              * Alta Combo
  2726.  
  2727.              * Artisoft LANtastic AE-2
  2728.  
  2729.              * Asante Etherpak 2001/2003,
  2730.  
  2731.              * D-Link Ethernet II
  2732.  
  2733.              * LTC E-NET/16 P/N 8300-200-002
  2734.  
  2735.              * Network Solutions HE-203,
  2736.  
  2737.              * SVEC 4 Dimension Ethernet
  2738.  
  2739.              * 4-Dimension FD0490 EtherBoard 16
  2740.  
  2741.              * D-Link DE-600
  2742.  
  2743.      Clones  which  are compatible with any of the above cards should work as
  2744.      well.
  2745.  
  2746.  
  2747.      2.9  Sources of Linux Information
  2748.  
  2749.      As you have probably guessed, there  are  many  sources  of  information
  2750.      about  Linux  available apart from this book. In particular, there are a
  2751.      number of books, not specific to Linux but rather about UNIX in general,
  2752.      that will be of importance, especially to those readers without previous
  2753.      UNIX experience.  If you are new to the UNIX world, we seriously suggest
  2754.      that  you  take the time to peruse one of these books before you attempt
  2755.  
  2756.  
  2757.                                 - 44 -
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.      to brave the jungles of Linux. Specifically, the book Learning the  UNIX
  2768.      Operating  System,  by  Grace Todino and John Strang, is a good place to
  2769.      start.
  2770.  
  2771.  
  2772.           Many of the following sources of information are  available  online
  2773.      in some electronic form. That is, you must have access to an online net¡
  2774.      work, such as the Internet, USENET, or Fidonet, in order to  access  the
  2775.      information  contained  therein. If you do not have online access to any
  2776.      of this material, you might be able to find someone kind enough to  give
  2777.      you hardcopies of the documents in question. Read on.
  2778.  
  2779.  
  2780.      2.9.1  Online documents
  2781.  
  2782.      If  you  have  access  to  the  Internet, there are many Linux documents
  2783.      available via anonymous FTP from archive sites all over  the  world.  If
  2784.      you  do  not  have  direct Internet access, these documents may still be
  2785.      available to you: they are distributed on many other networks  as  well,
  2786.      such as Fidonet and CompuServe. If you are able to send mail to Internet
  2787.      sites, you may be able to retrieve these files using one of the  ftpmail
  2788.      servers  which  will electronically mail you the documents or files from
  2789.      FTP archive sites.  See Appendix C for more information on using  ftp¡
  2790.      mail.
  2791.  
  2792.  
  2793.           There  is  a  great  number  of FTP archive sites which carry Linux
  2794.      software and related documents. A list of well-known Linux archive sites
  2795.      is given in Appendix C. In order to reduce network traffic, you should
  2796.      always use the FTP site which is geographically  (network-wise)  closest
  2797.      to you.
  2798.  
  2799.  
  2800.           Appendix  A  contains  a  listing  of some of the Linux documents
  2801.      which are available via anonymous FTP. The filenames will differ depend¡
  2802.      ing on the archive site in question; most sites keep Linux-related docu¡
  2803.      ments in the docs subdirectory of their Linux archive space.  For  exam¡
  2804.      ple,  on  the  FTP  site  sunsite.unc.edu, Linux files are stored in the
  2805.      directory /pub/Linux, with Linux-related documentation  being  found  in
  2806.      /pub/Linux/docs.
  2807.  
  2808.  
  2809.           Examples of available online documents are the Linux FAQ, a collec¡
  2810.      tion of freqeuently asked questions about Linux; the Linux  HOWTO  docu¡
  2811.      ments,  each  describing a specific aspect of the system---including the
  2812.      Installation HOWTO, the Printing HOWTO, and the Ethernet HOWTO; and, the
  2813.      Linux  META-FAQ,  a  list  of  other sources of Linux information on the
  2814.      Internet.
  2815.  
  2816.  
  2817.           Most of these documents are also regularly posted to  one  or  more
  2818.      Linux-related USENET newsgroups; see Section 2.9.3 below.
  2819.  
  2820.  
  2821.  
  2822.  
  2823.                                 - 45 -
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.      2.9.2  Books and other published works
  2834.  
  2835.      At  this  time,  there are few published works specifically about Linux.
  2836.      Most noteworthy are the books from the Linux  Documentation  Project,  a
  2837.      project  carried  out  over  the Internet to write and distribute a bona
  2838.      fide set of ``manuals'' for Linux. These manuals are  analogues  to  the
  2839.      documentation  sets  available  with  commercial  versions of UNIX: they
  2840.      cover everything from installing Linux, to using and running the system,
  2841.      programming, networking, kernel development, and more.
  2842.  
  2843.  
  2844.           The Linux Documentation Project manuals are available via anonymous
  2845.      FTP from the Internet, as well as via mail order from  several  sources.
  2846.      Appendix  A  lists the manuals which are available and covers means of
  2847.      obtaining them in detail.
  2848.  
  2849.  
  2850.           There are not many books specifically about Linux currently  avail¡
  2851.      able.  Several books have been published in Germany and Japan, including
  2852.      a translation of the Linux Documentation Project book Linux Installation
  2853.      and  Getting  Started.  However, there are a large number of books about
  2854.      UNIX in general which are certainly  applicable  to  Linux---as  far  as
  2855.      using  and  programming  the  system is concerned, Linux does not differ
  2856.      greatly from other implementations of UNIX. In short, almost  everything
  2857.      you  want  to  know  about  using  and programming Linux can be found in
  2858.      sources meant for a general UNIX audience. In fact, this book  is  meant
  2859.      to  be  complimented by the large library of UNIX books currently avail¡
  2860.      able; here, we present the most  important  Linux-specific  details  and
  2861.      hope  that you will look to other sources for more in-depth information.
  2862.  
  2863.  
  2864.           Armed with a number of good books about using UNIX, as well as  the
  2865.      book  you  hold  in  your hands, you should be able to tackle just about
  2866.      anything.  Appendix A  includes  a  list  of  highly-recommended  UNIX
  2867.      books, both for UNIX newcomers and UNIX wizards alike.
  2868.  
  2869.  
  2870.      2.9.3  USENET newsgroups
  2871.  
  2872.  
  2873.  
  2874.  
  2875.           USENET  is  a worldwide electronic news and discussion forum with a
  2876.      heavy contingent of so-called ``newsgroups''---discussion areas  devoted
  2877.      to  a  particular  topic. Much of the development of Linux has been done
  2878.      over the waves of the Internet and USENET, and not suprisingly there are
  2879.      a number of USENET newsgroups available for discussions about Linux.
  2880.  
  2881.  
  2882.           The  original  Linux newsgroup was alt.os.linux, and was created to
  2883.      move some of the discussions about Linux out of  comp.os.minix  and  the
  2884.      various  mailing  lists.  Soon,  the  traffic on alt.os.linux grew to be
  2885.      large enough that a newsgroup in the comp  hierarchy  was  warranted;  a
  2886.      vote was taken in February of 1992, and comp.os.linux was created.
  2887.  
  2888.  
  2889.                                 - 46 -
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.           comp.os.linux  quickly became one of the most popular (and loudest)
  2900.      USENET groups; more popular than any other comp.os group. In December of
  2901.      1992,  a  vote was taken to split the newsgroup in order to reduce traf¡
  2902.      fic; only comp.os.linux.announce passed this vote.  In July of 1993, the
  2903.      group  was  finally  split  into  the new hierarchy.  Almost 2000 people
  2904.      voted in the comp.os.linux reorganization, making it one of the  largest
  2905.      USENET CFV's ever.
  2906.  
  2907.  
  2908.           If  you  do not have direct USENET access, but are able to send and
  2909.      receive electronic mail from the Internet, there are mail-to-news  gate¡
  2910.      ways available for each of the newsgroups below.
  2911.  
  2912.  
  2913.  
  2914.  
  2915.              * comp.os.linux.announce  comp.os.linux.announce  is a moderated
  2916.                newsgroup for announcements and important postings  about  the
  2917.                Linux  system (such as bug reports, important patches to soft¡
  2918.                ware, and so on). If you read any  Linux  newsgroups  at  all,
  2919.                read this one. Often, the important postings in this group are
  2920.                not crossposted to other groups. This group also contains many
  2921.                periodic  postings  about  Linux, including many of the online
  2922.                documents described in the last section and listed in Appendix
  2923.                A.
  2924.  
  2925.  
  2926.                     Postings to this newsgroup must be approved by the moder¡
  2927.                ators, Matt Welsh and Lars Wirzenius. If you  wish  to  submit
  2928.                and  article  to this group, in most cases you can simply post
  2929.                the article as you normally would  (using  Pnews  or  whatever
  2930.                posting  software  that you have available); the news software
  2931.                will automatically forward the article to the  moderators  for
  2932.                approval.  However,  if  your  news  system is not set up cor¡
  2933.                rectly, you may need to mail the article directly; the submis¡
  2934.                sion address is linux-announce@tc.cornell.edu.
  2935.  
  2936.  
  2937.                     The  rest of the Linux newsgroups listed below are unmod¡
  2938.                erated.
  2939.  
  2940.  
  2941.              * comp.os.linux.help This is the most popular  Linux  newsgroup.
  2942.                It  is  for  questions and answers about using, setting up, or
  2943.                otherwise running a Linux system. If you are  having  problems
  2944.                with  Linux,  you  may  post  to this newsgroup, and hopefully
  2945.                receive a reply from someone who might be able to  help.  How¡
  2946.                ever, it is strongly suggested that you read all of the avail¡
  2947.                able Linux documentation  before  posting  questions  to  this
  2948.                newsgroup.
  2949.  
  2950.  
  2951.              * comp.os.linux.admin  This  newsgroup is for questions and dis¡
  2952.                cussion about running a Linux  system,  most  commonly  in  an
  2953.  
  2954.  
  2955.                                 - 47 -
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.                active,  multi-user environment. Any discussion about adminis¡
  2966.                trative issues of Linux (such as  packaging  software,  making
  2967.                backups, handling users, and so on) is welcome here.
  2968.  
  2969.  
  2970.              * comp.os.linux.development  This is a newsgroup for discussions
  2971.                about development of the Linux system.  All issues related  to
  2972.                kernel  and  system  software  development should be discussed
  2973.                here. For example, if you are writing a kernel driver and need
  2974.                help  with  certain  aspects of the programming, this would be
  2975.                the place to ask. This newsgroup is also for discussions about
  2976.                the  direction  and goals behind the Linux development effort,
  2977.                as described (somewhat) in Section 2.6.
  2978.  
  2979.  
  2980.                     It should be noted that this newsgroup  is  not  (techni¡
  2981.                cally)  for  discussions  about  development  of  software for
  2982.                Linux, but rather for discussions  of  development  of  Linux.
  2983.                That  is,  issues  dealing with applications programming under
  2984.                Linux  should  be  discussed  in  another   Linux   newsgroup;
  2985.                comp.os.linux.development is about developing the Linux system
  2986.                itself, including the kernel, system libraries, and so on.
  2987.  
  2988.  
  2989.              * comp.os.linux.misc This newsgroup is for all discussion  which
  2990.                doesn't  quite  fit  into the other available Linux groups. In
  2991.                particular, advocacy wars (the incessant ``Linux  versus  Win¡
  2992.                dows  NT''  thread,  for  example),  should  be waged here, as
  2993.                opposed to in the technical Linux groups. Any nontechnical  or
  2994.                metadiscourse   about   the  Linux  system  should  remain  in
  2995.                comp.os.linux.misc.
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.           It should be noted that  the  newsgroup  comp.os.linux,  which  was
  3002.      originally  the only Linux group, has been superceded by the new hierar¡
  3003.      chy of groups. If you have access to comp.os.linux, but not to the newer
  3004.      Linux  groups  listed above, encourage your news administrator to create
  3005.      the new groups on your system.
  3006.  
  3007.  
  3008.      2.9.4  Internet mailing lists
  3009.  
  3010.      If you have access to Internet electronic mail, you can participate in a
  3011.      number  of  mailing  lists  even if you do not have USENET access.  Note
  3012.      that if you are not directly on the Internet, you can join one of  these
  3013.      mailing  lists  as long as you are able to exchange electronic mail with
  3014.      the Internet (for example, UUCP, FidoNET, CompuServe, and other networks
  3015.      all have access to Internet mail).
  3016.  
  3017.  
  3018.           The  ``Linux  Activists''  mailing  list  is  primarily  for  Linux
  3019.  
  3020.  
  3021.                                 - 48 -
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.      developers and people interested in aiding the development process. This
  3032.      is  a  ``multi-channel''  mailing  list,  in  which you join one or more
  3033.      ``channels'' based on your particular interests. Some of  the  available
  3034.      channels  include: NORMAL, for general Linux-related issues; KERNEL, for
  3035.      kernel development; GCC, for discussions relating to  the  gcc  compiler
  3036.      and  library development; NET, for discussions about the TCP/IP network¡
  3037.      ing code; DOC, for issues relating to  writing  and  distributing  Linux
  3038.      documentation; and more.
  3039.  
  3040.  
  3041.           For  more  information about the Linux Activists mailing list, send
  3042.      mail to
  3043.  
  3044.  
  3045.           linux-activists@niksula.hut.fi
  3046.  
  3047.  
  3048.           You will receive a list of currently available channels,  including
  3049.      information  on  how to subscribe and unsubscribe to particular channels
  3050.      on the list.
  3051.  
  3052.  
  3053.           Quite a few special-purpose mailing lists about and for Linux exist
  3054.      as  well.   The  best  way to find out about these is to watch the Linux
  3055.      USENET newsgroups for announcements, as well as to read the list of pub¡
  3056.      licly-available  mailing  lists, periodically posted to the USENET group
  3057.      news.answers.
  3058.  
  3059.  
  3060.      2.10  Getting Help
  3061.  
  3062.      You will undoubtedly require  some  degree  of  assistance  during  your
  3063.      adventures  in  the  Linux world. Even the most wizardly of UNIX wizards
  3064.      occasionally is stumped by some quirk or  feature  of  Linux,  and  it's
  3065.      important to know how and where to find help when you need it.
  3066.  
  3067.  
  3068.           The primary means of getting help in the Linux world are via Inter¡
  3069.      net mailing lists and USENET newsgroups, as discussed in Section 2.9. If
  3070.      you don't have online access to these sources, you might be able to find
  3071.      comparable Linux discussion forums on other online services, such as  on
  3072.      local BBS's, CompuServe, and so on.
  3073.  
  3074.  
  3075.           A  number of businesses are providing commercial support for Linux.
  3076.      This will allow you to pay a ``subscription fee'' which will  allow  you
  3077.      to  call the consutants for help with your Linux problems.  Appendix B 
  3078.      contains a list of commercial sources for Linux support. However, if you
  3079.      have  access  to USENET and Internet mail, you may find the free support
  3080.      found there to be just as useful.
  3081.  
  3082.  
  3083.           Keeping the following suggestions in mind will greatly improve your
  3084.      experiences  with  Linux  and will guarantee you more success in finding
  3085.  
  3086.  
  3087.                                 - 49 -
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.      help to your problems.
  3098.  
  3099.  
  3100.           Consult all available documentation...first!  The first  thing  you
  3101.      should  do when encountering a problem is consult the various sources of
  3102.      information listed in Section 1.9 and Appendix A. These documents were
  3103.      laboriously  written for people like you---people who need help with the
  3104.      Linux system. Even books written for UNIX in general are  applicable  to
  3105.      Linux,  and  you  should  take advantage of them.  More than likely, you
  3106.      will find the answer to your problems somewhere in  this  documentation,
  3107.      as impossible as it may seem.
  3108.  
  3109.  
  3110.           If you have access to USENET news or any of the Linux-related mail¡
  3111.      ing lists, be sure to actually read the information there before posting
  3112.      for help with your problem. Many times, solutions to common problems are
  3113.      not easy to find in documentation, and instead are well-covered  in  the
  3114.      newsgroups and mailing lists devoted to Linux. If you only post to these
  3115.      groups, and don't actually read them, you are asking for trouble.
  3116.  
  3117.  
  3118.           Learn to appreciate self-maintenance.  In most cases, it is prefer¡
  3119.      able to do as much independent research and investigation into the prob¡
  3120.      lem as possible before seeking outside help.  After all, you  asked  for
  3121.      it,  by  running  Linux  in  the first place! Remember that Linux is all
  3122.      about hacking and fixing problems yourself. It is not a commerical oper¡
  3123.      ating  system, nor does it try to look like one. Hacking won't kill you.
  3124.      In fact, it will teach you a great deal about the system to  investigate
  3125.      and solve problems yourself---maybe even enough to one day call yourself
  3126.      a Linux guru. Learn to appreciate the value of hacking the  system,  and
  3127.      how  to fix problems yourself. You can't expect to run a complete, home¡
  3128.      brew Linux system without some degree of handiwork.
  3129.  
  3130.  
  3131.           Remain calm.  It is vital to refrain from getting  frustrated  with
  3132.      the system, at all costs. Nothing is earned by taking an axe---or worse,
  3133.      a powerful electromagnet---to your Linux system in a fit of  anger.  The
  3134.      authors have found that a large punching bag or similar inanimate object
  3135.      is a wonderful way to relieve the occasional  stress  attack.  As  Linux
  3136.      matures  and distributions become more reliable, we hope that this prob¡
  3137.      lem will go away. However, even commercial UNIX implementations  can  be
  3138.      tricky at times. When all else fails, sit back, take a few deep breaths,
  3139.      and go after the problem again when you feel relaxed. Your mind and con¡
  3140.      science will be clearer.
  3141.  
  3142.  
  3143.           Refrain  from  posting spuriously.  Many people make the mistake of
  3144.      posting or mailing messages pleading for help prematurely. When  encoun¡
  3145.      tering  a problem, do not---we repeat, do not---rush immediately to your
  3146.      nearest terminal and post a message to one of  the  Linux  USENET  news¡
  3147.      groups.  Often,  you  will catch your own mistake five minutes later and
  3148.      find yourself in the curious situation of defending your own sanity in a
  3149.      public  forum. Before posting anything any of the Linux mailing lists or
  3150.      newsgroups, first  attempt  to  resolve  the  problem  yourself  and  be
  3151.  
  3152.  
  3153.                                 - 50 -
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.      absolutely  certain  what  the  problem is. Does your system not respond
  3164.      when switched on? Perhaps the machine is unplugged.
  3165.  
  3166.  
  3167.           If you do post for help, make it worthwhile.  If  all  else  fails,
  3168.      you  may  wish  to post a message for help in any of the number of elec¡
  3169.      tronic forums dedicated to Linux, such as USENET newsgroups and  mailing
  3170.      lists.  When posting, remember that the people reading your post are not
  3171.      there to help you. The network is not your personal consulting  service.
  3172.      Therefore,  it  is important to remain as polite, terse, and informative
  3173.      as possible.
  3174.  
  3175.  
  3176.           How can one accomplish this? First,  you  should  include  as  much
  3177.      (relevant)  information  about your system and your problem as possible.
  3178.      Posting the simple request, ``I cannot seem to get e-mail to work'' will
  3179.      probably  get you nowhere unless you include information on your system,
  3180.      what software you are using, what you have attempted to do  so  far  and
  3181.      what the results were.  When including technical information, it is usu¡
  3182.      ally a good idea to include general information  on  the  version(s)  of
  3183.      your  software  (Linux  kernel version, for example), as well as a brief
  3184.      summary  of  your  hardware  configuration.    However,   don't   overdo
  3185.      it---including  information  on  the  brand and type of monitor that you
  3186.      have probably is irrelevant if you're  trying  to  configure  networking
  3187.      software.
  3188.  
  3189.  
  3190.           Secondly,  remember  that  you  need to make some attempt---however
  3191.      feeble---at solving your problem before you go to the Net. If  you  have
  3192.      never  attempted  to  set  up  electronic  mail, for instance, and first
  3193.      decide to ask folks on the Net how to go about doing it, you are  making
  3194.      a  big  mistake. There are a number of documents available (see the Sec¡
  3195.      tion 2.9) on how to get started with many common tasks under Linux.  The
  3196.      idea  is  to  get  as far along as possible on your own and then ask for
  3197.      help if and when you get stuck.
  3198.  
  3199.  
  3200.           Also remember that the people reading your message,  however  help¡
  3201.      ful, may occasionally get frustrated by seeing the same problem over and
  3202.      over again.  Be sure to actually read the Linux newsgroups  and  mailing
  3203.      lists  before  posting  your  problems. Many times, the solution to your
  3204.      problem has been discussed repeatedly, and all that's required  to  find
  3205.      it is to browse the current messages.
  3206.  
  3207.  
  3208.           Lastly,  when  posting  to electronic newsgroups and mailing lists,
  3209.      try to be as polite as possible. It is much more  effective  and  worth¡
  3210.      while  to be polite, direct, and informative---more people will be will¡
  3211.      ing to help you if you master a humble tone. To be sure, the  flame  war
  3212.      is  an art form across many forms of electronic communication, but don't
  3213.      allow that to preoccupy your and other people's time. Save  the  network
  3214.      undue wear and tear by keeping bandwidth as low as possible, and by pay¡
  3215.      ing as much attention to other sources of information which  are  avail¡
  3216.      able to you. The network is an excellent way to get help with your Linux
  3217.  
  3218.  
  3219.                                 - 51 -
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.      problems---but it is important to know how to  use  the  network  effec¡
  3230.      tively.
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.                                 - 52 -
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.      3.  Obtaining and Installing Linux
  3296.  
  3297.      In this chapter, we'll describe how to obtain the Linux software, in the
  3298.      form of one of  the  various  pre-packaged  distributions,  and  how  to
  3299.      install the distribution that you choose.
  3300.  
  3301.  
  3302.           As  we have mentioned, there is no single ``official'' distribution
  3303.      of the Linux software; there are, in fact, many distributions,  each  of
  3304.      which  serves a particular purpose and set of goals. These distributions
  3305.      are available via anonymous FTP from the Internet, on BBS systems world¡
  3306.      wide, and via mail on diskette, tape, and CD-ROM.
  3307.  
  3308.  
  3309.           Here,  we  present only a general overview of the installation pro¡
  3310.      cess.  Each distribution has its own specific installation instructions,
  3311.      but  armed  with  the concepts presented here you should be able to feel
  3312.      your way through any installation. Appendix A lists sources of  infor¡
  3313.      mation  for  installation  instructions  and  other help, if you're at a
  3314.      total loss.
  3315.  
  3316.  
  3317.      3.1  Distributions of Linux
  3318.  
  3319.      Because Linux is free software, no  single  organization  or  entity  is
  3320.      responsible  for  releasing  and  distributing  the software. Therefore,
  3321.      almost anyone is free to put together and distribute the Linux software,
  3322.      as  long as the restrictions in the GPL are observed. The upshot of this
  3323.      is that there are many distributions of Linux, available  via  anonymous
  3324.      FTP or via mail order.
  3325.  
  3326.  
  3327.           You  are now faced with the task of deciding upon a particular dis¡
  3328.      tribution of Linux which suits your needs.  Not  all  distributions  are
  3329.      alike.  Many of them come with just about all of the software you'd need
  3330.      to run a complete system---and then some. Other Linux distributions  are
  3331.      ``small''  distributions  intended  for users without copious amounts of
  3332.      diskspace. Many distributions contain only the core Linux software,  and
  3333.      you are expected to install larger software packages, such as the X Win¡
  3334.      dow System, yourself.  (In Chapter 5. we'll show you how.)
  3335.  
  3336.  
  3337.           In Appendix B, a brief list of Linux distributions is given.  You
  3338.      should  be able to contact the maintainers of each distribution for more
  3339.      information, should you need it.  This is only a cursory list  of  Linux
  3340.      releases;  for a more complete list, including information on other ser¡
  3341.      vices, see the Linux Distribution HOWTO  (information  on  which  is  in
  3342.      Appendix A).
  3343.  
  3344.  
  3345.           How  can  you  decide among all of these distributions? If you have
  3346.      access to USENET news, or  another  computer  conferencing  system,  you
  3347.      might  want  to  ask  there  for  personal opinions from people who have
  3348.      installed Linux. Even better, if you  know  someone  who  has  installed
  3349.  
  3350.  
  3351.                                 - 53 -
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.      Linux,  ask them for help and advice. There are many factors to consider
  3362.      when choosing a distribution, however, everyone's needs and opinions are
  3363.      different. In actuality, most of the popular Linux distributions contain
  3364.      roughly the same set of software, so the distribution that you select is
  3365.      more or less arbitrary.
  3366.  
  3367.  
  3368.      3.1.1  Getting Linux from the Internet
  3369.  
  3370.      If  you  have access to the Internet, the easiest way to obtain Linux is
  3371.      via  anonymous  FTP.(1) Appendix C lists a number of FTP archive sites
  3372.      which carry Linux software. One of these  is  sunsite.unc.edu,  and  the
  3373.      various Linux distributions can be found in the directory
  3374.  
  3375.  
  3376.           /pub/Linux/distributions
  3377.  
  3378.  
  3379.           there.
  3380.  
  3381.  
  3382.           Many  distributions are released via anonymous FTP as a set of disk
  3383.      images. That is, the distribution consists of a set of files,  and  each
  3384.      file  contains  the  binary image of a floppy. In order to copy the con¡
  3385.      tents of the image file onto the floppy, you  can  use  the  RAWRITE.EXE
  3386.      program under MS-DOS. This program copies, block-for-block, the contents
  3387.      of a file to a floppy, without regard for disk format.(2)
  3388.  
  3389.  
  3390.           RAWRITE.EXE  is available on the various Linux FTP sites, including
  3391.      sunsite.unc.edu in the directory
  3392.  
  3393.  
  3394.           /pub/Linux/system/Install/rawwrite
  3395.  
  3396.  
  3397.  
  3398.  
  3399.           Therefore, in many cases, you simply download the set  of  diskette
  3400.      images,  and  use RAWRITE.EXE with each image in turn to create a set of
  3401.      diskettes. You boot from the  so-called  ``boot  diskette''  and  you're
  3402.  
  3403.      
  3404.  
  3405.      1. If you do not have direct Internet access, you can obtain
  3406.         Linux via the ftpmail service, provided that you have the
  3407.         ability  to  exchange  e-mail  with  the  Internet.   See
  3408.         Appendix C for details.
  3409.      2. If you have access to a UNIX workstation  with  a  floppy
  3410.         drive,  you  can also use the dd command to copy the file
  3411.         image directly to the floppy.  A  command  such  as  ``dd
  3412.         of=/dev/rfd0  if=foo  bs=16k''  will  ``raw  write''  the
  3413.         contents of the file foo to the floppy device  on  a  Sun
  3414.         workstation.   Consult  your  local  UNIX  gurus for more
  3415.         information on your system's floppy devices and  the  use
  3416.         of dd.
  3417.  
  3418.                                 - 54 -
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.      ready to roll. The software is usually installed directly from the flop¡
  3429.      pies, although some distributions allow you to install  from  an  MS-DOS
  3430.      partition  on  your  hard drive. Some distributions allow you to install
  3431.      over a TCP/IP network. The documentation for  each  distribution  should
  3432.      describe these installation methods if they are available.
  3433.  
  3434.  
  3435.           Other Linux distributions are installed from a set of MS-DOS format
  3436.      floppies. For example, the SLS distribution of Linux requires  only  one
  3437.      of  the  image---the  ``a1''  diskette---to  be  written  diskette using
  3438.      RAWRITE.EXE. The rest of the files are copied to MS-DOS format diskettes
  3439.      labelled a2, a3, and so forth, using the MS-DOS COPY command. The system
  3440.      installs the software directly from the MS-DOS floppies. This saves  you
  3441.      the  trouble of having to use RAWRITE.EXE for many image files, although
  3442.      it requires you to have  access  to  an  MS-DOS  system  to  create  the
  3443.      diskettes.
  3444.  
  3445.  
  3446.           Each  distribution  of  Linux  available  via  anonymous FTP should
  3447.      include a README  file  describing  how  to  download  and  prepare  the
  3448.      diskettes  for  installation. Be sure to read all of the available docu¡
  3449.      mentation for the release that you are using---this book is  only  meant
  3450.      to give you the general idea.
  3451.  
  3452.  
  3453.           When downloading the Linux software, be sure to use binary mode for
  3454.      all file transfers  (with  most  FTP  clients,  the  command  ``binary''
  3455.      enables this mode).
  3456.  
  3457.  
  3458.      3.1.2  Getting Linux from other online sources
  3459.  
  3460.      If  you  have  access  to another computer network such as CompuServe or
  3461.      Prodigy, there may be a means to download the Linux software from  these
  3462.      sources.  In  addition,  many  bulletin  board (BBS) systems carry Linux
  3463.      software. Not  all Linux  distributions  are  available    from    these 
  3464.      computer networks, however---many of them, especially the various CD-ROM  
  3465.      distributions, are only available via mail order.
  3466.  
  3467.  
  3468.      3.1.3  Getting Linux via mail order
  3469.  
  3470.      If  you  don't have Internet or BBS access, many Linux distributions are
  3471.      available via mail order on diskette,  tape,  or  CD-ROM.  Appendix  B
  3472.      lists  a  number of these distributors. Many of them accept credit cards
  3473.      as well as international orders, so if you're not in the  United  States
  3474.      or Canada you still should be able to obtain Linux in this way.
  3475.  
  3476.  
  3477.           Linux  is  free  software, although distributors are allowed by the
  3478.      GPL to charge a fee for it. Therefore, ordering  Linux  via  mail  order
  3479.      might  cost you between US$30 and US$150, depending on the distribution.
  3480.      However, if you know someone who has already purchased or  downloaded  a
  3481.  
  3482.  
  3483.                                 - 55 -
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.      release of Linux, you are free to borrow or copy their software for your
  3494.      own use. Linux distributors are not allowed to restrict the  license  or
  3495.      redistribution  of  the  software  in any way. If you are thinking about
  3496.      installing an entire lab of machines with Linux, for example,  you  only
  3497.      need to purchase a single copy of one of the distributions, which can be
  3498.      used to install all of the machines.
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.      3.2  Preparing to Install Linux
  3505.  
  3506.      After you have obtained a distribution of Linux, you're ready to prepare
  3507.      your  system  for installation. The most important pre-installation step
  3508.      is repartitioning your drive to allocate space for Linux. This  takes  a
  3509.      certain  degree  of planning, especially if you're already running other
  3510.      operating systems. In the following sections we'll describe how to  plan
  3511.      for the Linux installation.
  3512.  
  3513.  
  3514.      3.2.1  Installation overview
  3515.  
  3516.      While  each release of Linux is different, in general the method used to
  3517.      install the software is as follows:
  3518.  
  3519.  
  3520.  
  3521.       01.  Repartition your hard drive(s). If you have other  operating  sys¡
  3522.            tems already installed, you will need to repartition the drives in
  3523.            order to allocate space for Linux. This is  discussed  in  Section
  3524.            3.2.4, below.
  3525.  
  3526.  
  3527.       02.  Boot  the Linux installation media. Each distribution of Linux has
  3528.            some   kind   of    installation    media---usually    a    ``boot
  3529.            floppy''---which  is  used  to  install the software. Booting this
  3530.            media will either present you with some kind of installation  pro¡
  3531.            gram, which will step you through the Linux installation, or allow
  3532.            you to install the software by hand.
  3533.  
  3534.  
  3535.       03.  Create Linux partitions. After repartitioning  to  allocate  space
  3536.            for  Linux,  you create Linux partitions on that empty space. This
  3537.            is accomplished with the Linux fdisk program, covered  in  Section
  3538.            3.3.3.
  3539.  
  3540.  
  3541.       04.  Create  filesystems and swap space. At this point, you will create
  3542.            one or more filesystems, used to store files, on the newly-created
  3543.            partitions.  In  addition, if you plan to use swap space, you will
  3544.            create the swap space on one of your Linux  partitions.   This  is
  3545.            covered in Sections 3.3.4 and 3.3.5.
  3546.  
  3547.  
  3548.  
  3549.                                 - 56 -
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.       05.  Install  the  software  on  the new filesystems. Finally, you will
  3560.            install the Linux  software  on  your  newly-created  filesystems.
  3561.            After  this,  it's smooth sailing---if all goes well. This is cov¡
  3562.            ered in Section 3.3.6. Later, in Section 3.5, we describe what  to
  3563.            do if anything goes wrong.
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.           Many  distributions  of Linux provide an installation program which
  3570.      will step you through the installation process, and automate one or more
  3571.      of  the  above  steps for you. Keep in mind throughout this chapter that
  3572.      any number of the above steps may be automated for you, depending on the
  3573.      distribution.
  3574.  
  3575.  
  3576.           Important  hint:  While preparing to install Linux, the best advice
  3577.      that we can give is to take notes during the  entire  procedure.   Write
  3578.      down  everything  that  you do, everything that you type, and everything
  3579.      that you see that might be out of the ordinary. The idea here is simple:
  3580.      if  (or when!) you run into trouble, you want to be able to retrace your
  3581.      steps and find out what went wrong. Installing  Linux  isn't  difficult,
  3582.      but there are many details to remember. You want to have a record of all
  3583.      of these details so that you can experiment with other methods if  some¡
  3584.      thing  goes  wrong.  Also, keeping a notebook of your Linux installation
  3585.      experience is useful when you want to ask other  people  for  help,  for
  3586.      example,  when  posting  a  message  to  one of the Linux-related USENET
  3587.      groups. Your notebook is also something that you'll want to show to your
  3588.      grandchildren someday.(3)
  3589.  
  3590.  
  3591.      3.2.2  Repartitioning concepts
  3592.  
  3593.      In general, hard drives are divided into partitions, where a single par¡
  3594.      tition is devoted to a single operating system. For example, on one hard
  3595.      drive, you may have several separate parititions---one devoted to,  say,
  3596.      MS-DOS, another to OS/2, and another to Linux.
  3597.  
  3598.  
  3599.           If  you  already  have other software installed on your system, you
  3600.      may need to resize those partitions in order to free up space for Linux.
  3601.      You  will then create one or more Linux partitions on the resulting free
  3602.      space for storing the Linux software and swap space. We call  this  pro¡
  3603.      cess repartitioning.
  3604.  
  3605.  
  3606.           Many  MS-DOS  systems  utilize  a  single  partition inhabiting the
  3607.      entire drive. To MS-DOS, this partition is known as C:. If you have more
  3608.  
  3609.      
  3610.  
  3611.      3. The  author  shamefully admits that he kept a notebook of
  3612.         all of his tribulations with  Linux  for  the  first  few
  3613.         months  of  working  with the system. It is now gathering
  3614.         dust on his bookshelf.
  3615.  
  3616.                                 - 57 -
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.      than one partition, MS-DOS names them D:, E:, and so on.  In a way, each
  3627.      partition acts like a separate hard drive.
  3628.  
  3629.  
  3630.           On the first sector of the disk is a master boot record along  with
  3631.      a partition table. The boot record (as the name implies) is used to boot
  3632.      the system. The partition table contains information about the locations
  3633.      and sizes of your partitions.
  3634.  
  3635.  
  3636.           There  are  three kinds of partitions: primary, extended, and logi¡
  3637.      cal. Of these, primary partitions are used most often.  However, because
  3638.      of  a  limit  in the size of the partition table, you can only have four
  3639.      primary partitions on any given drive.
  3640.  
  3641.  
  3642.           The way around this four-partition limit is to use an extended par¡
  3643.      tition.  An extended partition doesn't hold any data by itself; instead,
  3644.      it acts as a ``container'' for logical partitions. Therefore, you  could
  3645.      create  one extended partition, covering the entire drive, and within it
  3646.      create many logical partitions. However, you may have only one  extended
  3647.      partition per drive.
  3648.  
  3649.  
  3650.      3.2.3  Linux partition requirements
  3651.  
  3652.      Before  we  explain  how to repartition your drives, you need to have an
  3653.      idea of how much space you will be allocating for Linux. We will be dis¡
  3654.      cussing how to create these partitions later, in Section 3.3.3.
  3655.  
  3656.  
  3657.           On  UNIX systems, files are stored on a filesystem, which is essen¡
  3658.      tially a section of the hard drive (or other medium, such as  CD-ROM  or
  3659.      diskette)  formatted to hold files. Each filesystem is associated with a
  3660.      specific part of the directory tree; for example, on many systems, there
  3661.      is  a filesystem for all of the files in the directory /usr, another for
  3662.      /tmp, and so on. The root filesystem is the  primary  filesystem,  which
  3663.      corresponds to the topmost directory, /.
  3664.  
  3665.  
  3666.           Under  Linux,  each filesystem lives on a seperate partition on the
  3667.      hard drive. For instance, if you have a filesystem for / and another for
  3668.      /usr, you will need two partitions to hold the two filesystems.
  3669.  
  3670.  
  3671.           Before  you install Linux, you will need to prepare filesystems for
  3672.      storing the Linux software. You must have at least one  filesystem  (the
  3673.      root filesystem), and therefore one partition, allocated to Linux.  Many
  3674.      Linux users opt to store all of their  files  on  the  root  filesystem,
  3675.      which  is  in  most  cases easier to manage than several filesystems and
  3676.      partitions.
  3677.  
  3678.  
  3679.           However, you may create  multiple  filesystems  for  Linux  if  you
  3680.  
  3681.  
  3682.                                 - 58 -
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.      wish---for  example,  you  may want to use seperate filesystems for /usr
  3693.      and /home. Those readers with UNIX system administration experience will
  3694.      know  how  to use multiple filesystems creatively. In Chapter 5. we dis¡
  3695.      cuss the use of multiple partitions and filesystems.
  3696.  
  3697.  
  3698.           Why use more than one filesystem? The most commonly  stated  reason
  3699.      is  safety; if, for some reason, one of your filesystems is damaged, the
  3700.      others will (usually) be unharmed. On the other hand, if you  store  all
  3701.      of your files on the root filesystem, and for some reason the filesystem
  3702.      is damaged, then you may lose all of your files in one fell swoop.  This
  3703.      is,  however,  rather  uncommon;  if you backup the system regularly you
  3704.      should be quite safe.(4)
  3705.  
  3706.  
  3707.           Another reason to use multiple filesystems is to divvy  up  storage
  3708.      between multiple hard drives. If you have, say, 40 megabytes free on one
  3709.      hard drive, and 50 megabytes free on another, you might want to create a
  3710.      40-megabyte  root  filesystem  on the first drive and a 50-megabyte /usr
  3711.      filesystem on the other. Currently it  is  not  possible  for  a  single
  3712.      filesystem  to  span multiple drives; if your free hard drive storage is
  3713.      fragmented between drives you will need to use multiple  filesystems  to
  3714.      utilize it all.
  3715.  
  3716.  
  3717.           In  summary,  Linux  requires  at least one partition, for the root
  3718.      filesystem.  If you wish to create multiple filesystems, you will need a
  3719.      seperate partition for each additional filesystem. Some distributions of
  3720.      Linux automatically create partitions and filesystems for  you,  so  you
  3721.      may not need to worry about these issues at all.
  3722.  
  3723.  
  3724.           Another  issue  to  consider  when planning your partitions is swap
  3725.      space.  If you wish to use swap space with Linux, you have two  options.
  3726.      The  first  is  to  use  a  swap  file which exists on one of your Linux
  3727.      filesystems. You will create the swap file for use as virtual RAM  after
  3728.      you  install  the software. The second option is to create a swap parti¡
  3729.      tion, an individual partition to be used only as swap space. Most people
  3730.      use a swap partition instead of a swap file.
  3731.  
  3732.  
  3733.           A  single swap file or partition may be up to 16 megabytes in size.
  3734.      If you wish to use more than 16 megabytes of swap, you can create multi¡
  3735.      ple  swap  partitions or files---up to eight in all. For example, if you
  3736.      need 32 megabytes of swap, you can create two  16-megabyte  swap  parti¡
  3737.      tions.
  3738.  
  3739.  
  3740.           Setting  up  a swap partition is covered in Section 3.3.4, and set¡
  3741.      ting up a swap file in Chapter 5..
  3742.  
  3743.  
  3744.      
  3745.  
  3746.      4. The author uses a single 200-megabyte filesystem for  all
  3747.         of his Linux files, and hasn't had any problems (so far).
  3748.  
  3749.                                 - 59 -
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.           Therefore, in general, you will create at least two partitions  for
  3760.      Linux: one for use as the root filesystem, and the other for use as swap
  3761.      space.  There are, of course, many variations on the above, but this  is
  3762.      the  minimal  setup.  You are not required to use swap space with Linux,
  3763.      but if you have less than 16 megabytes of physical RAM  it  is  strongly
  3764.      suggested that you do.
  3765.  
  3766.  
  3767.           Of  course, you need to be aware of how much space these partitions
  3768.      will require. The size of your Linux filesystems (containing  the  soft¡
  3769.      ware  itself) depends greatly on how much software you're installing and
  3770.      what distribution of Linux you are using. Hopefully,  the  documentation
  3771.      that  came  with your distribution will give you an approximation of the
  3772.      space requirements. A small Linux system can use 20 megabytes or less; a
  3773.      larger  system  anywhere from 80 to 100 megabytes, or more. Keep in mind
  3774.      that in addition to the space required by the software itself, you  need
  3775.      to allocate extra space for user directories, room for future expansion,
  3776.      and so forth.
  3777.  
  3778.  
  3779.           The size of your swap partition  (should  you  elect  to  use  one)
  3780.      depends on how much virtual RAM you require. A rule of thumb is to use a
  3781.      swap partition that is twice the space of your physical RAM;  for  exam¡
  3782.      ple,  if you have 4 megabytes of physical RAM, an 8-megabyte swap parti¡
  3783.      tion should suffice.  Of course, this is mere  speculation---the  actual
  3784.      amount  of swap space that you require depends on the software which you
  3785.      will be running. If you have a great deal of physical RAM (say,  sixteen
  3786.      megabytes or more), you may not wish to use swap space at all.
  3787.  
  3788.  
  3789.           Important  note:  Many SCSI adaptors are incapable of booting soft¡
  3790.      ware from partitions using cylinders numbered over 1024. Therefore, when
  3791.      setting aside space for Linux, keep in mind that you may not want to use
  3792.      a partition in the >1024-cylinder range for your Linux root  filesystem.
  3793.      Linux  can  still use partitions with cylinders numbered over 1024, how¡
  3794.      ever, you may not be able to boot Linux  from  such  a  partition.  This
  3795.      advice  may  seem  premature, but it is important to know while planning
  3796.      your drive layout.
  3797.  
  3798.  
  3799.           If you absolutely must use a partition with cylinders numbered over
  3800.      1024  for  your  Linux  root  filesystem, you can always boot Linux from
  3801.      floppy.  This is not so bad, actually---it  only  takes  a  few  seconds
  3802.      longer  to  boot  than  from the hard drive. At any rate, it's always an
  3803.      option.
  3804.  
  3805.  
  3806.      3.2.4  Repartitioning your drives
  3807.  
  3808.      In this section, we'll describe how to resize  your  current  partitions
  3809.      (if  any)  to  make  space  for  Linux. If you are installing Linux on a
  3810.      ``clean'' hard drive, you can skip this section and proceed  to  Section
  3811.      3.3, below.
  3812.  
  3813.  
  3814.  
  3815.                                 - 60 -
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.           The usual way to resize an existing partition is to delete it (thus
  3826.      destroying all of the data on that partition) and  recreate  it.  Before
  3827.      repartitioning  your drives, backup your system. After resizing the par¡
  3828.      titions, you can reinstall your original software from the backup.  How¡
  3829.      ever,  there are several programs available for MS-DOS which are able to
  3830.      resize partitions nondestructively. One of these is known  as  ``FIPS'',
  3831.      and can be found on many Linux FTP sites.
  3832.  
  3833.  
  3834.           Also,  keep  in mind that because you'll be shrinking your original
  3835.      partitions, you may not have space  to  reinstall  everything.  In  this
  3836.      case,  you  need to delete enough unwanted software to allow the rest to
  3837.      fit on the smaller partitions.
  3838.  
  3839.  
  3840.           The program used to repartition is known as fdisk.  Each  operating
  3841.      system  has its own analogue of this program; for example, under MS-DOS,
  3842.      it is invoked with the FDISK command. You should consult your documenta¡
  3843.      tion for whatever operating systems you are currently running for infor¡
  3844.      mation on repartitioning. Here, we'll discuss how to  resize  partitions
  3845.      for  MS-DOS  using FDISK, but this information should be easily extrapo¡
  3846.      lated to other operating systems.
  3847.  
  3848.  
  3849.           Please consult the documentation for your current operating systems
  3850.      before  repartitioning your drive. This section is meant to be a general
  3851.      overview of the process; there are many subtleties that we do not  cover
  3852.      here.   You  can  lose  all of the software on your system if you do not
  3853.      repartition the drive correctly.
  3854.  
  3855.  
  3856.           A warning: Do not modify or create partitions for any other operat¡
  3857.      ing  systems (including Linux) using FDISK under MS-DOS. You should only
  3858.      modify partitions for a particular operating system with the version  of
  3859.      fdisk  included with that operating system; for example, you will create
  3860.      Linux partitions using a version of fdisk for Linux. Later,  in  Section
  3861.      3.3.3,  we  describe  how to create Linux partitions, but for now we are
  3862.      concerned with resizing your current ones.
  3863.  
  3864.  
  3865.           Let's say that you have a single hard drive on  your  system,  cur¡
  3866.      rently  devoted entirely to MS-DOS. Hence, your drive consists of a sin¡
  3867.      gle MS-DOS partition, commonly known as ``C:''.  Because  this  reparti¡
  3868.      tioning method will destroy the data on that partition, you need to cre¡
  3869.      ate a bootable MS-DOS ``system disk'' which contains  everything  neces¡
  3870.      sary  to run FDISK and restore the software from backup after the repar¡
  3871.      titioning is complete.
  3872.  
  3873.  
  3874.           In many cases, you can use the MS-DOS installation disks  for  this
  3875.      purpose.   However, if you need to create your own system disk, format a
  3876.      floppy with the command
  3877.  
  3878.  
  3879.  
  3880.  
  3881.                                 - 61 -
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.           FORMAT /s A:
  3892.  
  3893.  
  3894.           Copy onto this floppy all of the necessary MS-DOS  utilities  (usu¡
  3895.      ally  most of the software in the directory \DOS on your drive), as well
  3896.      as the programs FORMAT.COM and FDISK.EXE. You should now be able to boot
  3897.      this floppy, and run the command
  3898.  
  3899.  
  3900.           FDISK C:
  3901.  
  3902.  
  3903.           to start up FDISK.
  3904.  
  3905.  
  3906.           Use  of  FDISK  should  be self-explanatory, but consult the MS-DOS
  3907.      documentation for details. When you start FDISK, use the menu option  to
  3908.      display  the  partition  table, and write down the information displayed
  3909.      there. It is important to keep a record of your original setup  in  case
  3910.      you want to back out of the Linux installation.
  3911.  
  3912.  
  3913.           To  delete  an  existing  partition,  choose  the FDISK menu option
  3914.      ``Delete an MS-DOS Partition or Logical DOS Drive''.  Specify  the  type
  3915.      of partition that you wish to delete (primary, extended, or logical) and
  3916.      the number of the partition. Verify all of the warnings. Poof!
  3917.  
  3918.  
  3919.           To create a new (smaller) partition for  MS-DOS,  just  choose  the
  3920.      FDISK  option ``Create an MS-DOS Partition or Logical DOS Drive''. Spec¡
  3921.      ify the type of partition (primary, extended, or logical), and the  size
  3922.      of the partition to create (specified in megabytes). FDISK should create
  3923.      the partition and you're ready to roll.
  3924.  
  3925.  
  3926.           After you're done using FDISK, you  should  exit  the  program  and
  3927.      reformat  any  new partitions. For example, if you resized the first DOS
  3928.      partition on your drive (C:) you should run the command
  3929.  
  3930.  
  3931.           FORMAT /s C:
  3932.  
  3933.  
  3934.           You may now reinstall your original software from backup.
  3935.  
  3936.  
  3937.      3.3  Installing the Linux software
  3938.  
  3939.      After you have resized your existing partitions to make space for Linux,
  3940.      you  are  ready to install the software. Here is a brief overview of the
  3941.      procedure:
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.                                 - 62 -
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.              * Boot the Linux installation media;
  3958.  
  3959.              * Run fdisk under Linux to create Linux partitions;
  3960.  
  3961.              * Run mke2fs and mkswap to create  Linux  filesystems  and  swap
  3962.                space;
  3963.  
  3964.              * Install the Linux software;
  3965.  
  3966.              * Finally,  either  install  the  LILO  boot loader on your hard
  3967.                drive, or create a boot floppy in order to boot your new Linux
  3968.                system.
  3969.  
  3970.  
  3971.  
  3972.           As  we have said, one (or more) of these steps may be automated for
  3973.      you by the installation procedure,  depending  on  the  distribution  of
  3974.      Linux  which  you  are using.  Please consult the documentation for your
  3975.      distribution for specific instructions.
  3976.  
  3977.  
  3978.      3.3.1  Booting Linux
  3979.  
  3980.      The first step is to boot the Linux installation media. This  may  be  a
  3981.      floppy, tape, or CD-ROM, depending on the distribution.
  3982.  
  3983.  
  3984.           In  most  cases,  the installation media is a ``boot floppy'' which
  3985.      contains a small Linux system. Upon booting the floppy, you will be pre¡
  3986.      sented  with  an  installation  menu  of  some  kind which will lead you
  3987.      through the steps of installing the software.  On  other  distributions,
  3988.      you  will  be  presented  with  a login prompt when booting this floppy.
  3989.      Here, you usually login as root or install  to  begin  the  installation
  3990.      process.
  3991.  
  3992.  
  3993.           The documentation which came with your particular distribution will
  3994.      explain what is necessary to boot Linux from the installation media.
  3995.  
  3996.  
  3997.      3.3.2  Drives and partitions under Linux
  3998.  
  3999.      Many distributions require you to create Linux partitions by hand  using
  4000.      the  fdisk  program. Others may automatically create partitions for you.
  4001.      Either way, you should know the following information about Linux parti¡
  4002.      tions and device names.
  4003.  
  4004.  
  4005.           Drives  and  partitions  under Linux are given different names than
  4006.      their counterparts under other operating systems. Under  MS-DOS,  floppy
  4007.      drives  are  referred  to  as A: and B:, while hard drive partitions are
  4008.      named C:, D:, and so on. Under Linux, the  naming  convention  is  quite
  4009.      different.
  4010.  
  4011.  
  4012.  
  4013.                                 - 63 -
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.           Device  drivers,  found in the directory /dev, are used to communi¡
  4024.      cate with devices on your system (such as hard drives, mice, and so on).
  4025.      For  example,  if you have a mouse on your system, you access it through
  4026.      the driver /dev/mouse. Floppy drives, hard drives, and individual parti¡
  4027.      tions  are all given individual device drivers of their own. Don't worry
  4028.      about the device driver interface for  now;  it  is  important  only  to
  4029.      undertstand how the various devices are named in order to use them.
  4030.  
  4031.  
  4032.           Table 3.3.2 lists the names of these various device drivers.
  4033.  
  4034.  
  4035.  
  4036.           A few notes about this table. Note that /dev/fd0 corresponds to the
  4037.      first floppy drive (A: under MS-DOS) and  /dev/fd1  corresponds  to  the
  4038.      second floppy (B:).
  4039.  
  4040.  
  4041.           Also,  SCSI  hard  drives  are named differently than other drives.
  4042.      IDE, MFM, and RLL drives are  accessed  through  the  devices  /dev/hda,
  4043.      /dev/hdb, and so on. The individual partitions on the drive /dev/hda are
  4044.      /dev/hda1,  /dev/hda2,  and  so  on.  However,  SCSI  drives  are  named
  4045.      /dev/sda,  /dev/sdb,  etc.,  with  partition names such as /dev/sda1 and
  4046.      /dev/sda2.
  4047.  
  4048.  
  4049.           Here's an example. Let's say that you have a single IDE hard drive,
  4050.      with  3  primary partitions. The first two are set aside for MS-DOS, and
  4051.      the third is an extended partition which  contains  two  logical  parti¡
  4052.      tions,  both for use by Linux. The devices referring to these partitions
  4053.      would be:
  4054.  
  4055.  
  4056.      +---------------------------------------------+
  4057.      |First MS-DOS partition (C:)       /dev/hda1  |
  4058.      |Second MS-DOS partition (D:)      /dev/hda2  |
  4059.      |Extended partition                /dev/hda3  |
  4060.      |First Linux logical partition     /dev/hda5  |
  4061.      |Second Linux logical partition    /dev/hda6  |
  4062.      +---------------------------------------------+
  4063.  
  4064.  
  4065.  
  4066.  
  4067.           Note that /dev/hda4 is skipped; it corresponds to the  fourth  pri¡
  4068.      mary partition, which we don't have in this example.  Logical partitions
  4069.      are named consecutively starting with /dev/hda5.
  4070.  
  4071.  
  4072.      3.3.3  Creating Linux partitions
  4073.  
  4074.      Now you are ready to create Linux partitions with the fdisk command.  As
  4075.      described  in Section 3.2.3, in general you will need to create at least
  4076.      one partition for the Linux software itself, and another  partition  for
  4077.  
  4078.  
  4079.                                 - 64 -
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.            +----------------------------------------------------------+
  4091.            |                                                          |
  4092.  
  4093.            |Device                                         Name       |
  4094.            |                                                          |
  4095.  
  4096.            |First floppy (A:)                              /dev/fd0   |
  4097.            |Second floppy (B:)                             /dev/fd1   |
  4098.            |First hard drive (entire drive)                /dev/hda   |
  4099.            |First hard drive, primary partition 1          /dev/hda1  |
  4100.            |First hard drive, primary partition 2          /dev/hda2  |
  4101.            |First hard drive, primary partition 3          /dev/hda3  |
  4102.            |First hard drive, primary partition 4          /dev/hda4  |
  4103.            |First hard drive, logical partition 1          /dev/hda5  |
  4104.            |First hard drive, logical partition 2          /dev/hda6  |
  4105.            |...                                                       |
  4106.            |Second hard drive (entire drive)               /dev/hdb   |
  4107.            |Second hard drive, primary partition 1         /dev/hdb1  |
  4108.            |...                                                       |
  4109.            |First SCSI hard drive (entire drive)           /dev/sda   |
  4110.            |First SCSI hard drive, primary partition 1     /dev/sda1  |
  4111.            |...                                                       |
  4112.            |Second SCSI hard drive (entire drive)          /dev/sdb   |
  4113.            |Second SCSI hard drive, primary partition 1    /dev/sdb1  |
  4114.            |...                                                       |
  4115.            +----------------------------------------------------------+
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.                        TABLE 1.  Linux partition names
  4123.  
  4124.  
  4125.      swap space.
  4126.  
  4127.  
  4128.           After booting the installation media, run fdisk by typing
  4129.  
  4130.  
  4131.           fdisk <drive>
  4132.  
  4133.  
  4134.           where <drive> is the Linux device name of the drive you plan to add
  4135.      partitions to (see Table 3.3.2).  For instance, if you want to run fdisk
  4136.      on  the  first SCSI disk in your system, use the command fdisk /dev/sda.
  4137.      /dev/hda (the first IDE drive) is the default if you don't specify  one.
  4138.  
  4139.  
  4140.           If  you  are  creating Linux partitions on more than one drive, run
  4141.      fdisk once for each drive.
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.                                 - 65 -
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.           # fdisk /dev/hda
  4158.  
  4159.  
  4160.           Command (m for help):
  4161.  
  4162.  
  4163.           Here fdisk is waiting for a command; you can type m to get  a  list
  4164.      of options.
  4165.  
  4166.  
  4167.           Command (m for help):  m
  4168.           Command action
  4169.           a   toggle a bootable flag
  4170.           d   delete a partition
  4171.           l   list known partition types
  4172.           m   print this menu
  4173.           n   add a new partition
  4174.           p   print the partition table
  4175.           q   quit without saving changes
  4176.           t   change a partition's system id
  4177.           u   change display/entry units
  4178.           v   verify the partition table
  4179.           w   write table to disk and exit
  4180.           x   extra functionality (experts only)
  4181.  
  4182.  
  4183.           Command (m for help):
  4184.  
  4185.  
  4186.           The n command is used to create a new partition.  Most of the other
  4187.      options you won't need to worry about. To quit fdisk without saving  any
  4188.      changes,  use  the q command. To quit fdisk and write the changes to the
  4189.      partition table to disk, use the w command.
  4190.  
  4191.  
  4192.           The first thing you should do is  display  your  current  partition
  4193.      table  and  write  the  information down, for later reference. Use the p
  4194.      command.
  4195.  
  4196.  
  4197.           Command (m for help):  p
  4198.           Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders
  4199.           Units = cylinders of 608 * 512 bytes
  4200.  
  4201.              Device Boot  Begin   Start     End  Blocks   Id  System
  4202.           /dev/hda1   *       1       1     203   61693    6  DOS 16-bit >=32M
  4203.  
  4204.           Command (m for help):
  4205.  
  4206.  
  4207.           In this example, we have a single MS-DOS  partition  on  /dev/hda1,
  4208.      which is 61693 blocks (about 60 megs). This partition starts at cylinder
  4209.      number 1, and ends on cylinder 203. We have a total of 683 cylinders  in
  4210.      this  disk;  so  there are 480 cylinders left to create Linux partitions
  4211.  
  4212.  
  4213.                                 - 66 -
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.      on.
  4224.  
  4225.  
  4226.           To create a new partition, use the  n  command.  In  this  example,
  4227.      we'll create two primary partitions (/dev/hda2 and /dev/hda3) for Linux.
  4228.  
  4229.  
  4230.           Command (m for help): n
  4231.           Command action
  4232.             e   extended
  4233.             p   primary partition (1-4)
  4234.             p
  4235.  
  4236.  
  4237.           Here, fdisk is asking the type of the partition to create: extended
  4238.      or  primary.  In our example, we're creating only primary partitions, so
  4239.      we choose p.
  4240.  
  4241.  
  4242.           Partition number (1-4):
  4243.  
  4244.  
  4245.           fdisk will then ask for the number  of  the  partition  to  create;
  4246.      since  partition  1  is  already used, our first Linux partition will be
  4247.      number 2.
  4248.  
  4249.  
  4250.           Partition number (1-4): 2
  4251.           First cylinder (204-683):
  4252.  
  4253.  
  4254.           Now enter the starting cylinder  number  of  the  partition.  Since
  4255.      cylinders  204 through 683 are unused, we'll use the first available one
  4256.      (numbered 204).  There's no reason to leave empty space  between  parti¡
  4257.      tions.
  4258.  
  4259.  
  4260.           First cylinder (204-683): 204
  4261.           Last cylinder or +size or +sizeM or +sizeK (204-683):
  4262.  
  4263.  
  4264.           fdisk  is  asking  for  the size of the partition to create. We can
  4265.      either specify an ending cylinder number, or a size in bytes, kilobytes,
  4266.      or  megabytes.   Since  we  want our partition to be 80 megs in size, we
  4267.      specify +80M. When specifying a partition size in this way,  fdisk  will
  4268.      round the actual partition size to the nearest number of cylinders.
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.                                 - 67 -
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.           Last  cylinder  or  +size  or +sizeM or +sizeK (204-683):
  4290.           +80M
  4291.  
  4292.  
  4293.           Warning: Linux cannot currently use 33090 sectors of this
  4294.           partition
  4295.  
  4296.  
  4297.           If  you  see  a  warning  message  such as this, it can be ignored.
  4298.      fdisk prints the warning because it's an older program, and dates before
  4299.      the  time  that  Linux  partitions  were  allowed  to  be larger than 64
  4300.      megabytes.
  4301.  
  4302.  
  4303.           Now we're ready to create our second Linux partition. For  sake  of
  4304.      demonstration, we'll create it with a size of 10 megabytes.
  4305.  
  4306.  
  4307.           Command (m for help): n
  4308.           Command action
  4309.           e   extended
  4310.           p   primary partition (1-4)
  4311.           p
  4312.           Partition number (1-4): 3
  4313.           First cylinder (474-683): 474
  4314.           Last  cylinder  or  +size  or +sizeM or +sizeK (474-683):
  4315.           +10M
  4316.  
  4317.  
  4318.  
  4319.  
  4320.           Lastly, we'll display the partition table. Again, write down all of
  4321.      this  information---especially  the  block sizes of your new partitions.
  4322.      You'll need to know the sizes of the partitions when  creating  filesys¡
  4323.      tems, later.  Also, verify that none of your partitions overlap.
  4324.  
  4325.  
  4326.           Command (m for help): p
  4327.  
  4328.  
  4329.           Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders
  4330.           Units = cylinders of 608 * 512 bytes
  4331.  
  4332.              Device Boot  Begin   Start     End  Blocks   Id  System
  4333.           /dev/hda1   *       1       1     203   61693    6  DOS 16-bit >=32M
  4334.           /dev/hda2         204     204     473   82080   81  Linux/MINIX
  4335.           /dev/hda3         474     474     507   10336   81  Linux/MINIX
  4336.  
  4337.  
  4338.           As  you  can see, /dev/hda2 is now a partition of size 82080 blocks
  4339.      (which corresponds to about 80 megabytes), and /dev/hda3 is 10336 blocks
  4340.      (about 10 megs).
  4341.  
  4342.  
  4343.  
  4344.  
  4345.                                 - 68 -
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.           In the example above, the remaining cylinders on the disk (numbered
  4356.      508 to 683) are unused. You may wish to leave unused space on the  disk,
  4357.      in case you wish to create additional partitions later.
  4358.  
  4359.  
  4360.           Finally, we use the w command to write the changes to disk and exit
  4361.      fdisk.
  4362.  
  4363.  
  4364.           Command (m for help): w
  4365.  
  4366.  
  4367.           #
  4368.  
  4369.  
  4370.  
  4371.           Keep in mind that none of the changes you make while running  fdisk
  4372.      will  take effect until you give the w command, so you can toy with dif¡
  4373.      ferent configurations and save them when you're done. Also, if you  want
  4374.      to quit fdisk at any time without saving the changes, use the q command.
  4375.      Remember that you shouldn't  modify  partitions  for  operating  systems
  4376.      other than Linux with the Linux fdisk program.
  4377.  
  4378.  
  4379.           Remember  that  you  may not be able to boot Linux from a partition
  4380.      using cylinders numbered over 1024. Therefore, you should try to  create
  4381.      your  Linux root partition within the sub-1024 cylinder range. Again, if
  4382.      this is impossible, you can simply boot Linux from floppy.
  4383.  
  4384.  
  4385.           Some Linux distributions require you to  reboot  the  system  after
  4386.      running  fdisk.  This  is to allow the changes to the partition table to
  4387.      take effect before installing the  software.  Newer  versions  of  fdisk
  4388.      automatically update the partition information in the kernel, so reboot¡
  4389.      ing isn't necessary. To be on the safe side,  after  running  fdisk  you
  4390.      should reboot the installation media, as before, before proceeding.
  4391.  
  4392.  
  4393.      3.3.4  Creating the swap space
  4394.  
  4395.      If  you  are  planning  to  use a swap partition for virtual RAM, you're
  4396.      ready to prepare it for use.(5) In Chapter 5. we will discuss the prepa¡
  4397.      ration of a swap file in case you don't want to use an individual parti¡
  4398.      tion.
  4399.  
  4400.  
  4401.           Many distributions require you to create and  activate  swap  space
  4402.      before  installing  the software. If you have a small amount of physical
  4403.      RAM, the installation procedure may not be successful  unless  you  have
  4404.      some amount of swap space enabled.
  4405.  
  4406.      
  4407.  
  4408.      5. Again, some distributions of Linux will prepare the  swap
  4409.         space  automatically for you, or via an installation menu
  4410.         option.
  4411.  
  4412.                                 - 69 -
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.           The  command  used  to  prepare  a swap partition is mkswap, and it
  4423.      takes the form
  4424.  
  4425.  
  4426.           mkswap -c <partition> <size>
  4427.  
  4428.  
  4429.           where <partition> is the name of the swap partition, and <size>  is
  4430.      the size of the partition, in blocks.(6) For example, if your swap  par¡
  4431.      tition is /dev/hda3 and is 10336 blocks in size, use the command
  4432.  
  4433.  
  4434.           # mkswap -c /dev/hda3 10336
  4435.  
  4436.  
  4437.           The -c option tells mkswap to check for bad blocks on the partition
  4438.      when creating the swap space.
  4439.  
  4440.  
  4441.           If you are using multiple swap partitions, you will need to execute
  4442.      the appropriate mkswap command for each partition.
  4443.  
  4444.  
  4445.           After  formatting  the swap space, you need to enable it for use by
  4446.      the system. Usually, the system automatically enables swap space at boot
  4447.      time.   However,  because you have not yet installed the Linux software,
  4448.      you need to enable it by hand.
  4449.  
  4450.  
  4451.           The command to enable swap space is mkswap, and it takes the form
  4452.  
  4453.  
  4454.           swapon <partition>
  4455.  
  4456.  
  4457.           In the example above, to enable the swap space on /dev/hda3, we use
  4458.      the command
  4459.  
  4460.  
  4461.           # swapon /dev/hda3
  4462.  
  4463.  
  4464.  
  4465.  
  4466.      3.3.5  Creating the filesystems
  4467.  
  4468.      Before you can use your Linux partitions to store files, you must create
  4469.      filesystems on them. Creating a filesystem is analogous to formatting  a
  4470.      partition under MS-DOS or other operating systems. We discussed filesys¡
  4471.      tems briefly in Section 3.2.3.
  4472.  
  4473.  
  4474.      
  4475.  
  4476.      6. This  is  the size as reported by fdisk, using the p menu
  4477.         option. A block under Linux is 1024 bytes.
  4478.  
  4479.                                 - 70 -
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.           There are several types of filesystems available  for  Linux.  Each
  4490.      filesystem  type  has its own format and set of characteristics (such as
  4491.      filename length, maximum file size, and so on). Linux also supports sev¡
  4492.      eral ``third-party'' filesystem types such as the MS-DOS filesystem.
  4493.  
  4494.  
  4495.           The  most  commonly  used  filesystem  type  is the Second Extended
  4496.      Filesystem, or ext2fs. The ext2fs is one of the most efficient and flex¡
  4497.      ible  filesystems; it allows filenames up to 256 characters and filesys¡
  4498.      tem sizes of up to 4 terabytes. In Chapter 5., we'll discuss the various
  4499.      filesystem  types  available  for  Linux. Initially, however, we suggest
  4500.      that you use the extfs filesystem.
  4501.  
  4502.  
  4503.           To create an ext2fs filesystem, use the command
  4504.  
  4505.  
  4506.           mke2fs -c <partition> <size>
  4507.  
  4508.  
  4509.           where <partition> is the name of the partition, and <size>  is  the
  4510.      size  of  the  partition in blocks. For example, to create a 82080-block
  4511.      filesystem on /dev/hda2, use the command
  4512.  
  4513.  
  4514.           # mke2fs -c /dev/hda2 82080
  4515.  
  4516.  
  4517.  
  4518.  
  4519.           If you're using multiple filesystems for Linux, you'll need to  use
  4520.      the appropriate mke2fs command for each filesystem.
  4521.  
  4522.  
  4523.           If you have encountered any problems at this point, see Section 3.5
  4524.      at the end of this chapter.
  4525.  
  4526.  
  4527.      3.3.6  Installing the software
  4528.  
  4529.      Finally, you are ready to install the software  on  your  system.  Every
  4530.      distribution  has  a  different mechanism for doing this. Many distribu¡
  4531.      tions have a self-contiained program which will  step  you  through  the
  4532.      installation.   On  other  distributions,  you  will  have to mount your
  4533.      filesystems in a certain subdirectory (such as /mnt) and copy the  soft¡
  4534.      ware  to  them  by  hand.  On CD-ROM distributions, you may be given the
  4535.      option to install a portion of the software on  your  hard  drives,  and
  4536.      leave most of the software on the CD-ROM.
  4537.  
  4538.  
  4539.           Some  distributions  offer  several  different  ways to install the
  4540.      software. For example, you may be able to install the software  directly
  4541.      from  an  MS-DOS partition on your hard drive, instead of from floppies.
  4542.      Or, you may be able to install over a TCP/IP network via FTP or NFS. See
  4543.  
  4544.  
  4545.                                 - 71 -
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.      your distribution's documentation for details.
  4556.  
  4557.  
  4558.           As  an  example,  the  SLS distribution of Linux uses the doinstall
  4559.      command to install the software. It takes the form
  4560.  
  4561.  
  4562.           doinstall <rootfs> <fs1>  <mount-pt1>  <fs2>  <mount-pt2>
  4563.           ...<fsN> <mount-ptN>
  4564.  
  4565.  
  4566.           where  <rootfs>  is  the  name  of  your root filesystem, <fs1> and
  4567.      <mount-pt1> are the names of an  additional  filesystem  and  the  mount
  4568.      point for that filesystem, and so on.  For example, if you have a single
  4569.      filesystem for Linux on /dev/hda2, you would install the  software  with
  4570.      the command
  4571.  
  4572.  
  4573.           # doinstall /dev/hda2
  4574.  
  4575.  
  4576.           If  you  had  an  additional  filesystem on /dev/hda4 for /usr, you
  4577.      would instead use the command
  4578.  
  4579.  
  4580.           # doinstall /dev/hda2 /dev/hda4 /usr
  4581.  
  4582.  
  4583.  
  4584.  
  4585.           Again, the above commands are meant only  as  examples.  The  exact
  4586.      method used to install the Linux software differs greatly with each dis¡
  4587.      tribution.  We're hoping that installing the Linux  software  should  be
  4588.      self-explanatory, as it is with most distributions.
  4589.  
  4590.  
  4591.      3.3.7  Creating the boot floppy or installing LILO
  4592.  
  4593.      Every  distribution provides some means of booting your new Linux system
  4594.      after you have installed the software. In many cases,  the  installation
  4595.      procedure  will  create  a ``boot floppy'' which contains a Linux kernel
  4596.      configured to use your newly-created root filesystem. In order  to  boot
  4597.      Linux,  you would boot from this floppy, and control would be tranferred
  4598.      to your hard drive after booting.  On other distributions,  this  ``boot
  4599.      floppy'' is the installation floppy itself.
  4600.  
  4601.  
  4602.           Many  distributions  give you the option of installing LILO on your
  4603.      hard drive. LILO is a program that is installed on your  drive's  master
  4604.      boot record. It is able to boot a number of operating systems, including
  4605.      MS-DOS and Linux, and allows you to select  at  startup  time  which  to
  4606.      boot.
  4607.  
  4608.  
  4609.  
  4610.  
  4611.                                 - 72 -
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.           In  order  for LILO to be installed sucessfully, it needs to know a
  4622.      good deal of information about your drive  configuration---for  example,
  4623.      which partitions contain which operating systems, how to boot each oper¡
  4624.      ating system, and so  on.  Many  distributions,  when  installing  LILO,
  4625.      attempt  to  ``guess'' at the appropriate parameters for your configura¡
  4626.      tion.  Although it's not often, the automated LILO installation provided
  4627.      by  some  distributions  can  fail, and leave your master boot record in
  4628.      shambles (although it's very doubtful that any damage to the actual data
  4629.      on  your  hard  drive will take place). In particular, if you use OS/2's
  4630.      Boot Manager, you should not install LILO  using  the  automated  proce¡
  4631.      dure---there  are special instructions for using LILO with the Boot Man¡
  4632.      ager, which will be covered later.
  4633.  
  4634.  
  4635.           In many cases, it is best to use a boot floppy, until  you  have  a
  4636.      change to configure LILO yourself, by hand. If you're feeling exception¡
  4637.      ally trustworthy, though, you can  go  ahead  with  the  automated  LILO
  4638.      installation if it is provided with your distribution.
  4639.  
  4640.  
  4641.           In  Chapter  5., we'll cover in detail how to configure and install
  4642.      LILO for your particular setup.
  4643.  
  4644.  
  4645.           If everything  goes  well,  then  congratulations!  You  have  just
  4646.      installed  Linux  on your system. Go have a Diet Coke or something---you
  4647.      deserve it.
  4648.  
  4649.  
  4650.           In case you did  run  into  any  trouble,  the  next  section  will
  4651.      describe  the  most  common sticking points for Linux installations, and
  4652.      how to get around them.
  4653.  
  4654.  
  4655.      3.3.8  Additional installation procedures
  4656.  
  4657.      Some distributions of Linux provide a number of additional  installation
  4658.      procedures,  allowing you to configure various software packages such as
  4659.      TCP/IP networking, the X Window System, and so on. If you  are  provided
  4660.      with  these  configuration  options during installation, you may wish to
  4661.      read ahead in this book for more information on how  to  configure  this
  4662.      software.  Otherwise,  you  should put off these installation procedures
  4663.      until you have a complete understanding of how to  configure  the  soft¡
  4664.      ware.
  4665.  
  4666.  
  4667.           It's  up  to  you; if all else fails, just go with the flow and see
  4668.      what happens. It's very doubtful that anything that you  do  incorrectly
  4669.      now cannot be undone in the future. (Knock on wood.)
  4670.  
  4671.  
  4672.      3.4  Postinstallation procedures
  4673.  
  4674.      After  you have completed installing the Linux software, there should be
  4675.  
  4676.  
  4677.                                 - 73 -
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.      very little left to do before you can begin to use the system.  In  most
  4688.      cases, you should be able to reboot the system, login as root, and begin
  4689.      exploring the system. (Each distribution  has  a  different  method  for
  4690.      doing this---follow the instructions given by the distribution.)
  4691.  
  4692.  
  4693.           At  this  point it's a good idea to explain how to reboot and shut¡
  4694.      down the system as you're using it.  You should never reboot or shutdown
  4695.      your  Linux system by pressing the reset switch or with the old ``Vulcan
  4696.      Nerve Pinch''---that is,  by  pressing  `ctrl-alt-del'  in  unison.  You
  4697.      shouldn't  simply  switch  off the power, either. As with most UNIX sys¡
  4698.      tems, Linux caches disk writes in memory.  Therefore,  if  you  suddenly
  4699.      reboot the system without shutting down ``cleanly'', you can corrupt the
  4700.      data on your drives, causing untold damage.
  4701.  
  4702.  
  4703.           The easiest way to shut down the system is with the  shutdown  com¡
  4704.      mand.  As an example, to shutdown and reboot the system immediately, use
  4705.      the following command as root:
  4706.  
  4707.  
  4708.           # shutdown -r now
  4709.  
  4710.  
  4711.           This will cleanly reboot your system. The  man  page  for  shutdown
  4712.      describes the other command-line arguments that are available.
  4713.  
  4714.  
  4715.           Note,  however,  that  many  Linux distributions do not provide the
  4716.      shutdown command on the installation media. This means  that  the  first
  4717.      time  you reboot your system after installation, you may need to use the
  4718.      `ctrl-alt-del' combination after all. Thereafter, you should always  use
  4719.      the shutdown command.
  4720.  
  4721.  
  4722.           After  you  have  a chance to explore and use the system, there are
  4723.      several configuration chores that you should undertake. The first is  to
  4724.      create a user account for yourself (and, optionally, for any other users
  4725.      that might have  access  to  the  system).  Creating  user  accounts  is
  4726.      described in Section 5.4.
  4727.  
  4728.  
  4729.           If  you  created  more  than one filesystem for Linux, or if you're
  4730.      using a swap partition, you may need to  edit  the  file  /etc/fstab  in
  4731.      order  for those filesystems to be available automatically after reboot¡
  4732.      ing.  (For example, if you're using a separate filesystem for /usr,  and
  4733.      none of the files that should be in /usr don't appear to be present, you
  4734.      may simply need to mount that filesystem.)  Section 5.8  describes  this
  4735.      procedure.
  4736.  
  4737.  
  4738.      3.5  Running Into Trouble
  4739.  
  4740.      Almost everyone runs into some kind of snag or hangup when attempting to
  4741.  
  4742.  
  4743.                                 - 74 -
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.      install Linux the first time. Most of the time, the problem is caused by
  4754.      a  simple misunderstanding. Sometimes, however, it can be something more
  4755.      serious, such as an oversight by one of the developers, or a bug.
  4756.  
  4757.  
  4758.           This section will describe some of  the  most  common  installation
  4759.      problems, and how to solve them. If your installation appears to be suc¡
  4760.      cessful, but you received unexpected error messages during the installa¡
  4761.      tion, these are described here as well.
  4762.  
  4763.  
  4764.      3.5.1  Problems with booting the installation media
  4765.  
  4766.      When  attempting  to boot the installation media for the first time, you
  4767.      may encounter a number of problems. These are listed below.   Note  that
  4768.      the  following  problems are not related to booting your newly-installed
  4769.      Linux system. See Section 3.5.4 for information on these kinds  of  pit¡
  4770.      falls.
  4771.  
  4772.  
  4773.  
  4774.  
  4775.              * Floppy or media error when attempting to boot.
  4776.  
  4777.  
  4778.                     The most popular cause for this kind of problem is a cor¡
  4779.                rupt boot floppy. Either the floppy is physically damaged,  in
  4780.                which  case  you  should  re-create  the disk with a brand new
  4781.                floppy, or the data on the floppy is bad, in  which  case  you
  4782.                should  verify that you downloaded and transferred the data to
  4783.                the floppy correctly. In many cases,  simply  re-creating  the
  4784.                boot  floppy  will solve your problems. Retrace your steps and
  4785.                try again.
  4786.  
  4787.  
  4788.                     If you received your boot floppy from a mail order vendor
  4789.                or some other distributor, instead of downloading and creating
  4790.                it yourself, contact the distributor and ask for  a  new  boot
  4791.                floppy---but  only  after  verifying  that  this is indeed the
  4792.                problem.
  4793.  
  4794.  
  4795.              * System ``hangs'' during boot or after booting.
  4796.  
  4797.  
  4798.                     After the installation media boots, you will see a number
  4799.                of  messages  from the kernel itself, indicating which devices
  4800.                were detected and configured. After this, you will usually  be
  4801.                presented  with  a  login prompt, allowing you to proceed with
  4802.                installation (some distributions instead drop you  right  into
  4803.                an  installation  program of some kind). The system may appear
  4804.                to ``hang'' during several of these steps. During all of these
  4805.                steps,  be patient; loading software from floppy is very slow.
  4806.                In many cases, the system has not hung at all, but  is  merely
  4807.  
  4808.  
  4809.                                 - 75 -
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.                taking  a  long  time. Verify that there is no drive or system
  4820.                activity for at least several minutes before assuming that the
  4821.                system is hung.
  4822.  
  4823.  
  4824.                 01.  After booting from the LILO prompt, the system must load
  4825.                      the kernel image from floppy. This may take several sec¡
  4826.                      onds;  you  will  know that things are going well if the
  4827.                      floppy drive light is still on.
  4828.  
  4829.  
  4830.                 02.  While the kernel boots, SCSI devices must be probed for.
  4831.                      If  you do not have any SCSI devices installed, the sys¡
  4832.                      tem will ``hang'' for up to 15 seconds  while  the  SCSI
  4833.                      probe continues; this usually occurs after the line
  4834.  
  4835.  
  4836.                           lp init:  lp1  exists  (0), using polling
  4837.                           driver
  4838.  
  4839.  
  4840.                           appears on your screen.
  4841.  
  4842.  
  4843.                 03.  After the kernel is finished booting, control is  trans¡
  4844.                      ferred  to  the  system  bootup  files  on  the  floppy.
  4845.                      Finally, you will be presented with a login  prompt,  or
  4846.                      be dropped into an installation program. If you are pre¡
  4847.                      sented with a login prompt such as
  4848.  
  4849.  
  4850.                           Linux login:
  4851.  
  4852.  
  4853.                           you  should  then  login  (usually   as   root   or
  4854.                      install---this  varies  with  each  distribution). After
  4855.                      entering the username, the system may pause for 20  sec¡
  4856.                      onds  or more while the installation program or shell is
  4857.                      being loaded from floppy. Again, the floppy drive  light
  4858.                      should be on.  Don't assume that the system is hung.
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.                     Any of the above items may be the source of your problem.
  4865.                However, it is possible that the system actually may  ``hang''
  4866.                while  booting,  which  can be due to several causes. First of
  4867.                all, you may not have enough available RAM to boot the instal¡
  4868.                lation  media. (See the following item for information on dis¡
  4869.                abling the ramdisk to free up memory.)
  4870.  
  4871.  
  4872.                     The   cause   of   many   system   hangs   is    hardware
  4873.  
  4874.  
  4875.                                 - 76 -
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.                incompatibility.  Section 2.8 in the last chapter presented an
  4886.                overview of supported hardware under Linux. Even if your hard¡
  4887.                ware is supported, you may run into problems with incompatible
  4888.                hardware configurations which are causing the system to  hang.
  4889.                See  Section 3.5.2, below, for a discussion of hardware incom¡
  4890.                patibilities.
  4891.  
  4892.  
  4893.              * System reports out of memory errors while attempting  to  boot
  4894.                or install the software.
  4895.  
  4896.  
  4897.                     This item deals with the amount of available RAM that you
  4898.                have available. On systems with 4 megabytes of  RAM  or  less,
  4899.                you  may  run  into  trouble booting the installation media or
  4900.                installing the software itself. This is because many distribu¡
  4901.                tions use a ``ramdisk'', which is a filesystem loaded directly
  4902.                into RAM, for operations while using the  installation  media.
  4903.                The entire image of the installation boot floppy, for example,
  4904.                may be loaded into a ramdisk, which may require  more  than  a
  4905.                megabyte of RAM.
  4906.  
  4907.  
  4908.                     The  solution  to  this problem is to disable the ramdisk
  4909.                option when booting the install media. Each release has a dif¡
  4910.                ferent procedure for doing this; on the SLS release, for exam¡
  4911.                ple, you type ``floppy'' at the LILO prompt when  booting  the
  4912.                a1 disk.  See your distribution's documentation for details.
  4913.  
  4914.  
  4915.                     You  may not see an ``out of memory'' error when attempt¡
  4916.                ing to boot or install the software; instead, the  system  may
  4917.                unexpectedly  hang, or fail to boot. If your system hangs, and
  4918.                none of the explanations in the previous section  seem  to  be
  4919.                the cause, try disabling the ramdisk.
  4920.  
  4921.  
  4922.                     Keep  in  mind  that  Linux  itself  requires  at least 2
  4923.                megabytes of RAM to run at all; some  distributions  of  Linux
  4924.                require 4 megabytes or more.
  4925.  
  4926.  
  4927.              * The  system  reports an error such as ``permission denied'' or
  4928.                ``file not found'' while booting.
  4929.  
  4930.  
  4931.                     This is an indication that your installation bootup media
  4932.                is corrupt. If you attempt to boot from the installation media
  4933.                (and you're sure that you're doing everything correctly),  you
  4934.                should not see any errors such as this.  Contact the distribu¡
  4935.                tor of your Linux software and find out about the problem, and
  4936.                perhaps obtain another copy of the boot media if necessary. If
  4937.                you downloaded the bootup disk yourself, try  re-creating  the
  4938.                bootup disk, and see if this solves your problem.
  4939.  
  4940.  
  4941.                                 - 77 -
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.              * The  system  reports  the  error ``VFS: Unable to mount root''
  4952.                when booting.
  4953.  
  4954.  
  4955.                     This error message means that the root filesystem  (found
  4956.                on the boot media itself), could not be found. This means that
  4957.                either your boot media is corrupt in some way, or that you are
  4958.                not booting the system correctly.
  4959.  
  4960.  
  4961.                     For  example,  many CD-ROM distributions require that you
  4962.                have the CD-ROM in the drive when booting. Also be  sure  that
  4963.                the  CD-ROM drive is on, and check for any activity. It's also
  4964.                possible that the system is not locating your CD-ROM drive  at
  4965.                boot time; see Section 3.5.2 for more information.
  4966.  
  4967.  
  4968.                     If you're sure that you are booting the system correctly,
  4969.                then your bootup media may indeed be corrupt. This is  a  very
  4970.                uncommon  problem, so try other solutions before attempting to
  4971.                use another boot floppy or tape.
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.      3.5.2  Hardware problems
  4978.  
  4979.      The most common form of problem when attempting to install or use  Linux
  4980.      is  an  incompatibility  with  hardware. Even if all of your hardware is
  4981.      supported by Linux, a misconfiguration or hardware  conflict  can  some¡
  4982.      times  cause  strange results---your devices may not be detected at boot
  4983.      time, or the system may hang.
  4984.  
  4985.  
  4986.           It is important to isolate these hardware problems if  you  suspect
  4987.      that  they  may be the source of your trouble. In the following sections
  4988.      we will describe some common hardware problems and how to resolve  them.
  4989.  
  4990.  
  4991.      3.5.2.1  Isolating hardware problems
  4992.      If you experience a problem that you believe to be hardware-related, the
  4993.      first thing that you should to do is attempt  to  isolate  the  problem.
  4994.      This  means  eliminating all possible variables and (usually) taking the
  4995.      system apart, piece-by-piece, until the offending piece of  hardware  is
  4996.      isolated.
  4997.  
  4998.  
  4999.           This  is  not as frightening as it may sound. Basically, you should
  5000.      remove all nonessential hardware from your system,  and  then  determine
  5001.      which  device  is actually causing the trouble---possibly by reinserting
  5002.      each device, one at a time. This means that you should remove all  hard¡
  5003.      ware other than the floppy and video controllers, and of course the key¡
  5004.      board. Even innocent-looking devices such as mouse controllers can wreak
  5005.  
  5006.  
  5007.                                 - 78 -
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.      unknown  havoc  on your peace of mind unless you consider them nonessen¡
  5018.      tial.
  5019.  
  5020.  
  5021.           For example, let's say that the system hangs  during  the  Ethernet
  5022.      board  detection sequence at boot time. You might hypothesize that there
  5023.      is a conflict or problem with the Ethernet board in  your  machine.  The
  5024.      quick  and  easy  way to find out is to pull the Ethernet board, and try
  5025.      booting again. If everything goes well, then you know  that  either  (a)
  5026.      the Ethernet board is not supported by Linux (see Section 2.8 for a list
  5027.      of compatible boards), or (b) there is an address or IRQ  conflict  with
  5028.      the board.
  5029.  
  5030.  
  5031.           ``Address  or  IRQ  conflict?''  What on earth does that mean?  All
  5032.      devices in your machine use an IRQ, or interrupt request line,  to  tell
  5033.      the  system that they need something done on their behalf. You can think
  5034.      of the IRQ as a cord that the device tugs when it needs  the  system  to
  5035.      take  care  of some pending request.  If more than one device is tugging
  5036.      on the same cord, the kernel won't be able to detemine which  device  it
  5037.      needs to service. Instant mayhem.
  5038.  
  5039.  
  5040.           Therefore,  be  sure  that  all of your installed devices are using
  5041.      unique IRQ lines. In general the IRQ for a device can be set by  jumpers
  5042.      on  the  card;  see  the  documentation  for  the  particular device for
  5043.      details.  Some devices do not require the use of an IRQ at all,  but  it
  5044.      is suggested that you configure them to use one if possible (the Seagate
  5045.      ST01 and ST02 SCSI controllers being good examples).
  5046.  
  5047.  
  5048.           In some cases, the kernel provided on your  installation  media  is
  5049.      configured  to  use  a  certain IRQ for certain devices. For example, on
  5050.      some distributions of Linux, the kernel is preconfigured to  use  IRQ  5
  5051.      for  the TMC-950 SCSI controller, the Mitsumi CD-ROM controller, and the
  5052.      bus mouse driver.  If you want to use two  or  more  of  these  devices,
  5053.      you'll  need  to  first  install  Linux  with  only one of these devices
  5054.      enabled, then recompile the kernel in order to change  the  default  IRQ
  5055.      for  one  of  them.   (See Chapter 5. for information on recompiling the
  5056.      kernel.)
  5057.  
  5058.  
  5059.           Another area where hardware conflicts can arise is with DMA (direct
  5060.      memory  access)  channels,  I/O  addresses, and shared memory addresses.
  5061.      All of these terms describe mechanisms through which the  system  inter¡
  5062.      faces  with  hardware  devices. Some Ethernet boards, for example, use a
  5063.      shared memory address as well as an IRQ to interface with the system. If
  5064.      any  of  these  are  in conflict with other devices, then the system may
  5065.      bahave unexpectedly.  You should be able to change the DMA channel,  I/O
  5066.      or  shared  memory  addresses  for your various devices with jumper set¡
  5067.      tings. (Unfortunately, some devices don't allow you to change these set¡
  5068.      tings.)
  5069.  
  5070.  
  5071.  
  5072.  
  5073.                                 - 79 -
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.           The  documentation for your various hardware devices should specify
  5084.      the IRQ, DMA channel, I/O address, or shared  memory  address  that  the
  5085.      devices  use,  and  how  to configure them. Again, the simple way to get
  5086.      around these problems is just to  temporarily  disable  the  conflicting
  5087.      devices until you have time to determine the cause of the problem.
  5088.  
  5089.  
  5090.           Table  3.5.2.1  is  a  list of IRQ and DMA channels used by various
  5091.      ``standard'' devices found on most systems. Almost all systems will have
  5092.      these  some  of  devices,  so you should avoid setting the IRQ or DMA of
  5093.      other devices in conflict with these values.
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.      3.5.2.2  Problems recognizing hard drive or controller
  5100.      When Linux boots, you should see a series of  messages  on  your  screen
  5101.      such as:
  5102.  
  5103.  
  5104.           Console: colour EGA+ 80x25, 8 virtual consoles
  5105.           Serial driver version 3.96 with no serial options enabled
  5106.           tty00 at 0x03f8 (irq = 4) is a 16450
  5107.           tty03 at 0x02e8 (irq = 3) is a 16550A
  5108.           lp init: lp1 exists (0), using polling driver
  5109.           ...
  5110.  
  5111.           Here, the kernel is detecting the various hardware devices  present
  5112.      on your system. At some point, you should see the line
  5113.  
  5114.  
  5115.           Partition check:
  5116.  
  5117.  
  5118.           followed by a list of recognized partitions, for example:
  5119.  
  5120.  
  5121.           Partition check:
  5122.             hda: hda1 hda2
  5123.             hdb: hdb1 hdb2 hdb3
  5124.  
  5125.  
  5126.           If,  for some reason, your drives or partitions are not recognized,
  5127.      then you will not be able to access them in any way.
  5128.  
  5129.  
  5130.           There are several things that can cause this to happen:
  5131.  
  5132.  
  5133.              * Hard drive or controller not supported. If  you  are  using  a
  5134.                hard  drive  controller  (IDE, SCSI, or otherwise) that is not
  5135.                supported by Linux, the kernel will not recognize your  parti¡
  5136.                tions at boot time.
  5137.  
  5138.  
  5139.                                 - 80 -
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.            +----------------------------------------------------------+
  5151.            |                                                          |
  5152.  
  5153.            |Device                         I/O address    IRQ    DMA  |
  5154.            |                                                          |
  5155.  
  5156.            |ttyS0 (COM1)                   3f8            4      n/a  |
  5157.            |ttyS1 (COM2)                   2f8            3      n/a  |
  5158.            |ttyS2 (COM3)                   3e8            4      n/a  |
  5159.            |ttyS3 (COM4)                   2e8            3      n/a  |
  5160.            |lp0 (LPT1)                     378 - 37f      7      n/a  |
  5161.            |lp1 (LPT2)                     278 - 27f      5      n/a  |
  5162.            |fd0, fd1 (floppies 1 and 2)    3f0 - 3f7      6      2    |
  5163.            |fd2, fd3 (floppies 3 and 4)    370 - 377      10     3    |
  5164.            +----------------------------------------------------------+
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.  
  5171.                       TABLE 2.  Common device settings
  5172.  
  5173.  
  5174.              * Drive  or controller improperly configured.  Even if your con¡
  5175.                troller is supported by Linux, it may not be  configured  cor¡
  5176.                rectly.  (This is particularly a problem for SCSI controllers;
  5177.                most non-SCSI controllers should work fine without  any  addi¡
  5178.                tional configuration).
  5179.  
  5180.  
  5181.                     Refer  to  the  documentation  for your hard drive and/or
  5182.                controller for information on solving these kinds of problems.
  5183.                In particular, many hard drives will need to have a jumper set
  5184.                if they are to be used as a ``slave'' drive (for  example,  as
  5185.                the  second hard drive). The acid test for this kind of condi¡
  5186.                tion is to boot up MS-DOS, or  some  other  operating  system,
  5187.                known  to  work  with  your  drive  and controller. If you can
  5188.                access the drive and controller from another operating system,
  5189.                then it is not a problem with your hardware configuration.
  5190.  
  5191.  
  5192.                     See  Section 3.5.2.1, above, for information on resolving
  5193.                possible device conflicts, and  Section  3.5.2.3,  below,  for
  5194.                information on configuring SCSI devices.
  5195.  
  5196.  
  5197.              * Controller  properly configured, but not detected.  Some BIOS-
  5198.                less SCSI controllers require the user to specify  information
  5199.                about  the  controller  at boot time.  Section 3.5.2.3, below,
  5200.                describes how to  force  hardware  detection  for  these  con¡
  5201.                trollers.
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.                                 - 81 -
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.              * Hard  drive geometry not recognized. Some systems, such as the
  5218.                IBM PS/ValuePoint, do not store hard drive  geometry  informa¡
  5219.                tion in the CMOS memory, where Linux expects to find it. Also,
  5220.                certain SCSI controllers need to be told where to  find  drive
  5221.                geometry  in  order  for Linux to recognize the layout of your
  5222.                drive.
  5223.  
  5224.  
  5225.                     Most distributions provide a bootup option to specify the
  5226.                drive  geometry.  In  general,  when  booting the installation
  5227.                media, you can specify the drive geometry  at  the  LILO  boot
  5228.                prompt with a command such as:
  5229.  
  5230.  
  5231.                     boot: linux hd=<cylinders>,<heads>,<sectors>
  5232.  
  5233.  
  5234.                     where  <cylinders>,  <heads>, and <sectors> correspond to
  5235.                the number of cylinders, heads, and sectors per track for your
  5236.                hard drive.
  5237.  
  5238.  
  5239.                     After  installing  the  Linux  software,  will be able to
  5240.                install LILO, allowing you to boot from  the  hard  drive.  At
  5241.                that  time,  you  can  specify  the drive geometry to the LILO
  5242.                installation procedure, making it  unnecessary  to  enter  the
  5243.                drive  geometry  each  time  you boot. See Chapter 5. for more
  5244.                about LILO.
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.      3.5.2.3  Problems with SCSI controllers and devices
  5251.      Presented here are some of the  most  common  problems  with  SCSI  con¡
  5252.      trollers  and  devices such as CD-ROMs, hard drives, and tape drives. If
  5253.      you are having problems getting Linux to recognize your  drive  or  con¡
  5254.      troller, read on.
  5255.  
  5256.  
  5257.           The Linux SCSI HOWTO (see Appendix A) contains much useful infor¡
  5258.      mation on SCSI devices in addition to that listed here. SCSI can be par¡
  5259.      ticularly tricky to configure at times.
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.              * A SCSI device is detected at all possible ID's. This is caused
  5266.                by strapping the device to the same address as the controller.
  5267.                You  need to change the jumper settings so that the drive uses
  5268.                a different address from the controller itself.
  5269.  
  5270.  
  5271.  
  5272.  
  5273.                                 - 82 -
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.              * Linux reports sense errors, even if the devices are  known  to
  5284.                be  error-free.  This  can  be caused by bad cables, or by bad
  5285.                termination. If your SCSI bus is not terminated at both  ends,
  5286.                you  may  have  errors  accessing SCSI devices. When in doubt,
  5287.                always check your cables.
  5288.  
  5289.  
  5290.              * SCSI devices report timeout errors. This is usually caused  by
  5291.                a conflict with IRQ, DMA, or device addresses. Also check that
  5292.                interrupts are enabled correctly on your controller.
  5293.  
  5294.  
  5295.              * SCSI controllers using BIOS are  not  detected.  Detection  of
  5296.                controllers  using  BIOS will fail if the BIOS is disabled, or
  5297.                if your controller's ``signature'' is not  recognized  by  the
  5298.                kernel.  See  the  Linux SCSI HOWTO for more information about
  5299.                this.
  5300.  
  5301.  
  5302.              * Controllers using memory mapped  I/O  do  not  work.  This  is
  5303.                caused  when  the  memory-mapped  I/O  ports  are  incorrectly
  5304.                cached. Either mark the board's address space  as  uncacheable
  5305.                in the XCMOS settings, or disable cache altogether.
  5306.  
  5307.  
  5308.              * When  partitioning,  you  get  a  warning  that  ``cylinders >
  5309.                1024'', or you are unable  to  boot  from  a  partition  using
  5310.                cylinders  numbered  above  1024.   BIOS  limits the number of
  5311.                cylinders to 1024, and any partition using cylinders  numbered
  5312.                above  this won't be accessible from the BIOS. As far as Linux
  5313.                is concerned, this affects only booting; once the  system  has
  5314.                booted  you  should  be  able  to  access  the partition. Your
  5315.                options are to either boot Linux from a boot floppy,  or  boot
  5316.                from a partition using cylinders numbered below 1024. See Sec¡
  5317.                tion 3.3.7 for information on  creating  a  boot  diskette  or
  5318.                installing LILO.
  5319.  
  5320.  
  5321.              * CD-ROM  drive or other removeable media devices are not recog¡
  5322.                nized at boot time. Try booting with a CD-ROM (or disk) in the
  5323.                drive. This is necessary for some devices.
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.           If  your  SCSI  controller is not recognized, you may need to force
  5330.      hardware detection at boot time.  This  is  particularly  important  for
  5331.      BIOS-less  SCSI controllers. Most distributions allow you to specify the
  5332.      controller IRQ and shared memory address when booting  the  installation
  5333.      media.  For  example,  if you are using a TMC-8xx controller, you may be
  5334.      able to enter
  5335.  
  5336.  
  5337.  
  5338.  
  5339.                                 - 83 -
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.           boot: linux tmx8xx=<interrupt>,<memory-address>
  5350.  
  5351.  
  5352.           at the LILO boot prompt, where  <interrupt>  is  the  IRQ  of  con¡
  5353.      troller,  and  <memory-address> is the shared memory address. Whether or
  5354.      not you will be able to do this depends on the distribution of Linux you
  5355.      are using; consult your documentation for details.
  5356.  
  5357.  
  5358.      3.5.3  Problems installing the software
  5359.  
  5360.      Actually  installing the Linux software should be quite trouble-free, if
  5361.      you're lucky. The only problems  that  you  might  experience  would  be
  5362.      related  to  corrupt  installation  media or lack of space on your Linux
  5363.      filesystems. Here is a list of these common problems.
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.              * System reports ``Read error'', ``file not  found'',  or  other
  5370.                errors  while  attempting  to  install  the  software. This is
  5371.                indicative of a problem with your installation media.  If  you
  5372.                are  installing  from  floppy,  keep in mind that floppies are
  5373.                quite succeptible to media errors of this type. Be sure to use
  5374.                brand-new,  newly-formatted  floppies.  If  you have an MS-DOS
  5375.                partition on your drive, many Linux distributions allow you to
  5376.                install  the  software from the hard drive. This may be faster
  5377.                and more reliable than using floppies.
  5378.  
  5379.  
  5380.                     If you are using a CD-ROM, be sure to check  the  CD  for
  5381.                scratches,  dust,  or  other  problems which might cause media
  5382.                errors.
  5383.  
  5384.  
  5385.                     The cause of the problem may be that the media is in  the
  5386.                incorrect  format.  For example, if using floppies, many Linux
  5387.                distributions require that the floppies be formatted in  high-
  5388.                density  MS-DOS  format. (The boot floppy is the exception; it
  5389.                is not in MS-DOS format in most cases.)  If  all  else  fails,
  5390.                either  obtain a new set of floppies, or recreate the floppies
  5391.                (using new diskettes) if you downloaded the software yourself.
  5392.  
  5393.  
  5394.              * System  reports  errors such as ``tar: read error'' or ``gzip:
  5395.                not in gzip format''.  This problem is usually caused by  cor¡
  5396.                rupt  files  on the installation media itself. In other words,
  5397.                your floppy may be error-free, but the data on the  floppy  is
  5398.                in  some  way  corrupted.  For  example, if you downloaded the
  5399.                Linux software using text mode, rather than binary mode,  then
  5400.                your files will be corrupt, and unreadable by the installation
  5401.                software.
  5402.  
  5403.  
  5404.  
  5405.                                 - 84 -
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.              * System  reports  errors  such   as   ``device   full''   while
  5416.                installing.  This is a clear-cut sign that you have run out of
  5417.                space when installing the software. Not  all  Linux  distribu¡
  5418.                tions  will be able to cleanly pick up the mess; you shouldn't
  5419.                be able to abort the installation and  expect  the  system  to
  5420.                work.
  5421.  
  5422.  
  5423.                     The  solution  is  usually  to re-create your filesystems
  5424.                (with the mke2fs command) which  will  delete  the  partially-
  5425.                installed  software.  You  can  then attempt to re-install the
  5426.                software, this time selecting a smaller amount of software  to
  5427.                install.   In  other  cases,  you may need to start completely
  5428.                from scratch, and rethink your partition and filesystem sizes.
  5429.  
  5430.  
  5431.              * System  reports  errors  such  as  ``read intr:  0x10''  while
  5432.                accessing the hard drive.  This is usually  an  indication  of
  5433.                bad blocks on your drive. However, if you receive these errors
  5434.                while using mkswap or mke2fs, the system may be having trouble
  5435.                accessing  your  drive.  This can either be a hardware problem
  5436.                (see Section 3.5.2), or it might be a case of poorly specified
  5437.                geometry. If you used the
  5438.  
  5439.  
  5440.                     hd=<cylinders>,<heads>,<sectors>
  5441.  
  5442.  
  5443.                     option  at  boot  time  to  force detection of your drive
  5444.                geometry, and incorrectly specified the geometry, you could be
  5445.                prone  to  this  problem.   This can also happen if your drive
  5446.                geometry is incorrectly specified in the system CMOS.
  5447.  
  5448.  
  5449.              * System reports errors such as ``file not found'' or  ``permis¡
  5450.                sion denied''. This problem can occur if not all of the neces¡
  5451.                sary files are present on the installation media (see the next
  5452.                paragraph)  or  if  there  is  a  permissions problem with the
  5453.                installation software.  For  example,  some  distributions  of
  5454.                Linux  have  been known to have bugs in the installation soft¡
  5455.                ware itself. These are usually fixed  very  rapidly,  and  are
  5456.                quite  infrequent.  If you suspect that the distribution soft¡
  5457.                ware contains bugs, and you're sure that  you  have  not  done
  5458.                anything  wrong, contact the maintainer of the distribution to
  5459.                report the bug.
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.           If you have other strange errors when installing Linux  (especially
  5466.      if  you  downloaded  the  software  yourself), be sure that you actually
  5467.      obtained all of the necessary files when downloading. For example,  some
  5468.      people use the FTP command
  5469.  
  5470.  
  5471.                                 - 85 -
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.           mget *.*
  5482.  
  5483.  
  5484.           when  downloading  the  Linux  software via FTP. This will download
  5485.      only those files that contain a ``.'' in their filenames; if  there  are
  5486.      any  files without the ``.'', you will miss them. The correct command to
  5487.      use in this case is
  5488.  
  5489.  
  5490.           mget *
  5491.  
  5492.  
  5493.  
  5494.  
  5495.           The best advice is to retrace your steps when something goes wrong.
  5496.      You may think that you have done everything correctly, when in fact your
  5497.      forgot a small but important step  somewhere  along  the  way.  In  many
  5498.      cases,  just  attempting to re-download or re-install the Linux software
  5499.      can solve the problem. Don't beat your head against the wall any  longer
  5500.      than you have to!
  5501.  
  5502.  
  5503.           Also, if Linux unexpectedly hangs during installation, there may be
  5504.      a hardware problem of some kind. See Section 3.5.2 for hints.
  5505.  
  5506.  
  5507.      3.5.4  Problems after installing Linux
  5508.  
  5509.      You've spent an entire afternoon installing  Linux.  In  order  to  make
  5510.      space  for  it, you wiped your MS-DOS and OS/2 partitions, and tearfully
  5511.      deleted your copies of SimCity and Wing Commander.  You reboot the  sys¡
  5512.      tem,  and  nothing  happens. Or, even worse, something happens, but it's
  5513.      not what should happen. What do you do?
  5514.  
  5515.  
  5516.           In Section 3.5.1, we covered some of the most common problems  that
  5517.      can  occur  when  booting  the  Linux installation media---many of those
  5518.      problems may apply here. In addition, you may be victim to  one  of  the
  5519.      following maladies.
  5520.  
  5521.  
  5522.      3.5.4.1  Problems booting Linux from floppy
  5523.      If  you  are  using  a floppy to boot Linux, you may need to specify the
  5524.      location of your Linux root partition at boot time. This  is  especially
  5525.      true if you are using the original installation floppy itself, and not a
  5526.      custom boot floppy created during installation.
  5527.  
  5528.  
  5529.           While booting the floppy, hold down `shift' or `ctrl'. This  should
  5530.      present  you  with  a  boot menu; press `tab' to see a list of available
  5531.      options. For example, many distributions allow you to type
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.                                 - 86 -
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.           boot: linux hd=<partition>
  5548.  
  5549.  
  5550.           at the boot menu, where <partition> is the name of the  Linux  root
  5551.      partition, such as /dev/hda2. Consult the documentation for your distri¡
  5552.      bution for details.
  5553.  
  5554.  
  5555.      3.5.4.2  Problems booting Linux from the hard drive
  5556.      If you opted to install LILO, instead of creating a  boot  floppy,  then
  5557.      you should be able to boot Linux from the hard drive. However, the auto¡
  5558.      mated LILO installation procedure used  by  many  distributions  is  not
  5559.      always  perfect.  It may make incorrect assumptions about your partition
  5560.      layout, in which case you will need to re-install LILO to get everything
  5561.      right. Installing LILO is covered in Chapter 5..
  5562.  
  5563.  
  5564.  
  5565.  
  5566.              * System  reports  ``Drive  not  bootable---Please insert system
  5567.                disk.''  You will get this error message if the  hard  drive's
  5568.                master  boot  record  is  corrupt in some way.  In most cases,
  5569.                it's harmless, and everything else  on  your  drive  is  still
  5570.                intact. There are several ways around this:
  5571.  
  5572.  
  5573.  
  5574.  
  5575.                 01.  While  partitioning your drive using fdisk, you may have
  5576.                      deleted the partition that was marked as ``active''. MS-
  5577.                      DOS  and  other  operating  systems  attempt to boot the
  5578.                      ``active'' partition at boot time (Linux pays no  atten¡
  5579.                      tion to whether the partition is ``active'' or not). You
  5580.                      may be able to boot MS-DOS and  run  FDISK  to  set  the
  5581.                      active  flag  on your MS-DOS paritition, and all will be
  5582.                      well.
  5583.  
  5584.  
  5585.                           Another command to try (with MS-DOS 5.0 and higher)
  5586.                      is
  5587.  
  5588.  
  5589.                           FDISK /MBR
  5590.  
  5591.  
  5592.                           This command will attempt to rebuild the hard drive
  5593.                      master boot record for booting MS-DOS, overwriting LILO.
  5594.                      If  you no longer have MS-DOS on your hard drive, you'll
  5595.                      need to boot Linux from floppy and  attempt  to  install
  5596.                      LILO later.
  5597.  
  5598.  
  5599.                 02.  If you created an MS-DOS partition using Linux's version
  5600.                      of fdisk, or vice versa, you may  get  this  error.  You
  5601.  
  5602.  
  5603.                                 - 87 -
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.                      should create MS-DOS partitions only using MS-DOS's ver¡
  5614.                      sion FDISK. (The same applies to operating systems other
  5615.                      than  MS-DOS.) The best solution here is either to start
  5616.                      from scratch and repartition the drive correctly, or  to
  5617.                      merely  delete  and  re-create  the offending partitions
  5618.                      using the correct version of fdisk.
  5619.  
  5620.  
  5621.                 03.  The LILO installation procedure may have failed. In this
  5622.                      case, you should either boot from your Linux boot floppy
  5623.                      (if you have one), or  from  the  original  installation
  5624.                      media. Either of these should provide options for speci¡
  5625.                      fying the Linux root partition to use when booting. Hold
  5626.                      down  `shift'  or  `ctrl'  at boot time, and press `tab'
  5627.                      from the boot menu for a list of options.
  5628.  
  5629.  
  5630.  
  5631.  
  5632.  
  5633.              * When booting the  system  from  the  hard  drive,  MS-DOS  (or
  5634.                another  operating  system)  starts instead of Linux. First of
  5635.                all, be sure that you actually installed LILO when  installing
  5636.                the  Linux  software.  If not, then the system will still boot
  5637.                MS-DOS (or whatever other operating system you may have)  when
  5638.                you  attempt  to  boot  from  the hard drive. In order to boot
  5639.                Linux from the hard drive, you will need to install LILO  (see
  5640.                Chapter 5.).
  5641.  
  5642.  
  5643.                     On  the  other hand, if you did install LILO, and another
  5644.                operating system boots instead of Linux, then  you  have  LILO
  5645.                configured  to  boot  that  other operating system by default.
  5646.                While the system is booting, hold down `shift' or `ctrl',  and
  5647.                press  `tab' at the boot prompt.  This should present you with
  5648.                a list of possible  operating  systems  to  boot;  select  the
  5649.                appropriate option (usually just ``linux'') to boot Linux.
  5650.  
  5651.  
  5652.                     If you wish to select Linux as the default operating sys¡
  5653.                tem to boot, you will need to re-install LILO. See Chapter 5..
  5654.  
  5655.  
  5656.                     It  also  may  be  possible that you attempted to install
  5657.                LILO, but the installation procedure failed in some  way.  See
  5658.                the previous item.
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.                                 - 88 -
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.      3.5.4.3  Problems logging in
  5680.      After  booting  Linux, you should be presented with a login prompt, like
  5681.      so:
  5682.  
  5683.  
  5684.           linux login:
  5685.  
  5686.  
  5687.           At this point, either the distribution's documentation or the  sys¡
  5688.      tem  itself will tell you what to do. For many distributions, you simply
  5689.      login as root, with no password. Other possible  usernames  to  try  are
  5690.      guest or test.
  5691.  
  5692.  
  5693.           Most  newly-installed  Linux  systems should not require a password
  5694.      for the initial login. However, if you are asked to  enter  a  password,
  5695.      there  may  be  a problem. First, try using a password equivalent to the
  5696.      username; that is, if you are logging in as root, use  ``root''  as  the
  5697.      password.
  5698.  
  5699.  
  5700.           If  you  simply can't login, there may be a problem. First, consult
  5701.      your distribution's documentation; the username and password to use  may
  5702.      be  buried  in  there somewhere. The username and password may have been
  5703.      given to you during the installation procedure, or they may  be  printed
  5704.      on the login banner.
  5705.  
  5706.  
  5707.           One  cause of this may be a problem with installing the Linux login
  5708.      and initialization files. In this is the case, you may need to reinstall
  5709.      (at  least parts of) the Linux software, or boot your installation media
  5710.      and attempt to fix the problem by hand---see Chapter 5. for hints.
  5711.  
  5712.  
  5713.      3.5.4.4  Problems using the system
  5714.      If login is successful, you should be  presented  with  a  shell  prompt
  5715.      (such  as  ``#'' or ``$'') and can happily roam around your system. How¡
  5716.      ever, there are some initial problems with using the system  that  some¡
  5717.      times creep up.
  5718.  
  5719.  
  5720.           The  most common initial configuration problem is incorrect file or
  5721.      directory permissions. This can cause the error message
  5722.  
  5723.  
  5724.           Shell-init: permission denied
  5725.  
  5726.  
  5727.           to be printed after logging in (in fact, any time you see the  mes¡
  5728.      sage  ``permission denied'' you can be fairly certain that it is a prob¡
  5729.      lem with file permissions).
  5730.  
  5731.  
  5732.           In many cases, it's a simple matter of using the chmod  command  to
  5733.  
  5734.  
  5735.                                 - 89 -
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.      fix  the permissions of the appropriate files or directories.  For exam¡
  5746.      ple, some distributions of Linux once used  the  (incorrect)  file  mode
  5747.      0644 for the root directory (/).  The fix was to issue the command
  5748.  
  5749.  
  5750.           # chmod 755 /
  5751.  
  5752.  
  5753.           as  root.  However,  in  order to issue this command, you needed to
  5754.      boot from the installation media and mount your Linux root filesystem by
  5755.      hand---a hairy task for most newcomers.
  5756.  
  5757.  
  5758.           As  you  use  the  system,  you  may run into places where file and
  5759.      directory permissions are incorrect, or software does not work  as  con¡
  5760.      figured.  Welcome  to  the  world of Linux! While most distributions are
  5761.      quite trouble-free, very few of them are  perfect.   We  don't  want  to
  5762.      cover  all of those problems here.  Instead, throughout the book we help
  5763.      you to solve many of these configuration problems by teaching you how to
  5764.      find them and fix them yourself. In Chapter 2. we discussed this philos¡
  5765.      ophy in some detail.  In Chapter 5., we give hints for  fixing  many  of
  5766.      these common configuration problems.
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.                                 - 90 -
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.      4.  Linux Tutorial
  5812.  
  5813.      4.1  Introduction
  5814.  
  5815.      New  users  of  UNIX  and Linux may be a bit intimidated by the size and
  5816.      apparent complexity of the system before them. There are many good books
  5817.      on  using  UNIX  out  there,  for all levels of expertise from novice to
  5818.      expert. However, none of these books covers, specifically, an  introduc¡
  5819.      tion  to  using  Linux.  While  95% of using Linux is exactly like using
  5820.      other UNIX systems, the most straightforward way to get  going  on  your
  5821.      new system is with a tutorial tailored for Linux. Herein is such a tuto¡
  5822.      rial.
  5823.  
  5824.  
  5825.           This chapter does not go into a large amount  of  detail  or  cover
  5826.      many  advanced topics. Instead, it is intended to get the new Linux user
  5827.      running, on both feet, so that he or she may then read  a  more  general
  5828.      book  about UNIX and understand the basic differences between other UNIX
  5829.      systems and Linux.
  5830.  
  5831.  
  5832.           Very little is assumed here, except perhaps some  familiarity  with
  5833.      personal  computer  systems,  and MS-DOS. However, even if you're not an
  5834.      MS-DOS user, you should be able to understand everything here. At  first
  5835.      glance,  UNIX  looks a lot like MS-DOS (after all, MS-DOS was modeled on
  5836.      the CP/M operating system, which in turn was modeled on UNIX).  However,
  5837.      only  the  very superficial features of UNIX resemble MS-DOS in any way.
  5838.      Even if you're completely new to the PC world, this tutorial  should  be
  5839.      of help.
  5840.  
  5841.  
  5842.           And,  before  we  begin:  Don't be afraid to experiment. The system
  5843.      won't bite you. You can't destroy anything by  working  on  the  system.
  5844.      UNIX  has  some amount of security built in, to prevent ``normal'' users
  5845.      (the role which you will now  assume)  from  damaging  files  which  are
  5846.      essential to the system. Even so, the absolute worst thing that can hap¡
  5847.      pen is that you'll delete all of your files---and you'll have to go back
  5848.      and  re-install the system. So, at this point, you have nothing to lose.
  5849.  
  5850.  
  5851.      4.2  Basic UNIX Concepts
  5852.  
  5853.      UNIX is a multitasking, multiuser operating  system.   This  means  that
  5854.      there  can  be  many people using one computer at the same time, running
  5855.      many different applications. (This differs from MS-DOS, where  only  one
  5856.      person  can  use  the  system at any one time.) Under UNIX, for users to
  5857.      identify themselves to the system, they must log in, which  entails  two
  5858.      steps:  Entering  your  login name (the name which the system identifies
  5859.      you as), and entering your password, which is your personal  secret  key
  5860.      to  logging  into  your account. Because only you know your password, no
  5861.      one else can login to the system under your username.
  5862.  
  5863.  
  5864.           On traditional UNIX systems, the system administrator  will  assign
  5865.  
  5866.  
  5867.                                 - 91 -
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.      you  a username and an initial password when you are given an account on
  5878.      the system. However, because you are the system administrator, you  must
  5879.      set up your own account before you can login---see Section 4.2.1, below.
  5880.      For  the  following  discussions,  we'll  use  the  imaginary   username
  5881.      ``larry''.
  5882.  
  5883.  
  5884.           In addition, each UNIX system has a hostname assigned to it.  It is
  5885.      this hostname that gives your machine a name,  gives  it  character  and
  5886.      charm.  The  hostname  is used to identify individual machines on a net¡
  5887.      work, but even if your machine isn't networked, it should have  a  host¡
  5888.      name.  In Section 5.10.2 we'll cover setting your system's hostname. For
  5889.      our examples, below, the system's hostname is ``mousehouse''.
  5890.  
  5891.  
  5892.      4.2.1  Creating an account
  5893.  
  5894.      Before you can use the system, you must set up a user account for  your¡
  5895.      self.  This  is  because  it's  usually  not a good idea to use the root
  5896.      account for normal use. The root account should be reserved for  running
  5897.      priveleged commands and for maintaining the system, as discussed in Sec¡
  5898.      tion 5.1.
  5899.  
  5900.  
  5901.           In order to create an account for yourself, you need  to  login  as
  5902.      root  and use the useradd or adduser command. See Section 5.4 for infor¡
  5903.      mation on this procedure.
  5904.  
  5905.  
  5906.      4.2.2  Logging in
  5907.  
  5908.       At login time, you'll see a prompt resembling  the  following  on  your
  5909.      screen:
  5910.  
  5911.  
  5912.           mousehouse login:
  5913.  
  5914.  
  5915.  
  5916.  
  5917.           Here,  enter  your  username, and press the `Return' key. Our hero,
  5918.      larry, would type the following:
  5919.  
  5920.  
  5921.           mousehouse login: larry
  5922.           Password:
  5923.  
  5924.  
  5925.  
  5926.  
  5927.           Now, enter your password. It won't be echoed to the screen when you
  5928.      login,  so  type carefully. If you mistype your password, you'll see the
  5929.      message
  5930.  
  5931.  
  5932.  
  5933.                                 - 92 -
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.           Login incorrect
  5944.  
  5945.  
  5946.           and you'll have to try again.
  5947.  
  5948.  
  5949.           Once you have correctly entered the username and password, you  are
  5950.      officially logged into the system, and are free to roam.
  5951.  
  5952.  
  5953.      4.2.3  Virtual consoles
  5954.  
  5955.      The  system's  console is the monitor and keyboard connected directly to
  5956.      the system. (Because UNIX is a multiuser operating system, you may  have
  5957.      other  terminals  connected  to  serial  ports on your system, but these
  5958.      would not be the console.) Linux, like some other versions of UNIX, pro¡
  5959.      vides access to virtual consoles (or VC's), which allow you to have more
  5960.      than one login session from your console at a time.
  5961.  
  5962.  
  5963.           To demonstrate this, login to your system (as demonstrated  above).
  5964.      Now,  press  `alt-F2'.  You  should  see the login: prompt again. You're
  5965.      looking at the second virtual console---you logged into  the  first.  To
  5966.      switch  back to the first VC, press `alt-F1'. Voila! You're back to your
  5967.      first login session.
  5968.  
  5969.  
  5970.           A newly-installed Linux system probably allows you  to  access  the
  5971.      first  four VC's, using `alt-F1' through `alt-F4'. However, it is possi¡
  5972.      ble to enable up to 12 VC's---one for each function  key  on  your  key¡
  5973.      board.  As  you  can  see, use of VC's can be very powerful---you can be
  5974.      working on several different VC's at once.
  5975.  
  5976.  
  5977.           While the use of VC's is somewhat limiting (after all, you can only
  5978.      be  looking  at  one VC at a time), it should give you a feel for UNIX's
  5979.      multiuser capabilities. While you're working on VC #1,  you  can  switch
  5980.      over to VC #2 and start working on something else.
  5981.  
  5982.  
  5983.      4.2.4  Shells and commands
  5984.  
  5985.      For most of your explorations in the world of UNIX, you'll be talking to
  5986.      the system through the use of a shell.  A shell is just a program  which
  5987.      takes  user  input  (e.g.,  commands which you type) and translates them
  5988.      into instructions. This can be compared to the COMMAND.COM program under
  5989.      MS-DOS,  which  does  essentially  the same thing. The shell is just one
  5990.      interface to UNIX. There are many possible interfaces---such  as  the  X
  5991.      Window  System,  which lets you run commands by using the mouse and key¡
  5992.      board in conjunction.
  5993.  
  5994.  
  5995.           As soon as you login, the system starts the shell, and you can type
  5996.      commands to it. Here's a quick example. Here, Larry logs in, and is left
  5997.  
  5998.  
  5999.                                 - 93 -
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.      sitting at the shell prompt.
  6010.  
  6011.  
  6012.           mousehouse login: larry
  6013.           Password: larry's password
  6014.           Welcome to Mousehouse!
  6015.           /home/larry#
  6016.  
  6017.           ``/home/larry#'' is the shell's prompt, indicating that it's  ready
  6018.      to  take  commands. (More on what the prompt itself means later.)  Let's
  6019.      try telling the system to do something interesting:
  6020.  
  6021.  
  6022.           /home/larry# make love
  6023.           make: *** No way to make target `love'. Stop.
  6024.           /home/larry#
  6025.  
  6026.  
  6027.  
  6028.           Well, as it turns out make was the name of an actual program on the
  6029.      system,  and  the  shell  executed  this program when given the command.
  6030.      (Unfortunately, the system was being unfriendly.)
  6031.  
  6032.  
  6033.           This brings us to one burning question:  What  are  commands?  What
  6034.      happens when you type ``make love''? The first word on the command line,
  6035.      ``make'', is the name of the command to be executed. Everything else  on
  6036.      the command line is taken as arguments to this command. Examples:
  6037.  
  6038.  
  6039.           /home/larry# cp foo bar
  6040.  
  6041.  
  6042.           Here,  the  name  of  the  command is ``cp'', and the arguments are
  6043.      ``foo'' and ``bar''.
  6044.  
  6045.  
  6046.           When you type a command, the shell does several  things.  First  of
  6047.      all,  it looks at the command name, and checks to see if it is a command
  6048.      which is internal to the shell. (That is,  a  command  which  the  shell
  6049.      knows  how  to execute itself. There are a number of these commands, and
  6050.      we'll go into them later.) The shell also checks to see if  the  command
  6051.      is  an  alias,  or  substitute  name, for another command. If neither of
  6052.      these conditions apply, the shell looks for a program, on the disk, with
  6053.      the command's name.  If it finds such a program, the shell runs it, giv¡
  6054.      ing the program the arguments specified on the command line.
  6055.  
  6056.  
  6057.           In our example, the shell looks for the program  called  make,  and
  6058.      runs  it with the argument love. Make is a program often used to compile
  6059.      large programs, and it takes as arguments the name of  a  ``target''  to
  6060.      compile. In the case of ``make love'', we instructed make to compile the
  6061.      target love. Because make can't find a target by  this  name,  it  fails
  6062.      with  a humorous error message, and we are returned to the shell prompt.
  6063.  
  6064.  
  6065.                                 - 94 -
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.           What happens if we type a command to a shell, and the  shell  can't
  6076.      find a program with the command name to run? Well, we can try it:
  6077.  
  6078.  
  6079.           /home/larry# eat dirt
  6080.           eat: command not found
  6081.           /home/larry#
  6082.  
  6083.           Quite simply, if the shell can't find a program with the name given
  6084.      on the command line (here, ``eat''), it prints an  error  message  which
  6085.      should  be  self-explanatory. You'll often see this error message if you
  6086.      mistype a command (for example, if you had typed ``mkae  love''  instead
  6087.      of ``make love'').
  6088.  
  6089.  
  6090.      4.2.5  Logging out
  6091.  
  6092.      Before  we  delve much further, we should tell you how to log out of the
  6093.      system. At the shell prompt, use the command
  6094.  
  6095.  
  6096.           /home/larry# exit
  6097.  
  6098.  
  6099.           to logout. There are other ways of logging out as well, but this is
  6100.      the most foolproof one.
  6101.  
  6102.  
  6103.      4.2.6  Changing your password
  6104.  
  6105.      You  should  also  be  aware of how to change your password. The command
  6106.      passwd will prompt you for your old password, and your new password.  It
  6107.      will  ask you to reenter the new password for validation. Be careful not
  6108.      to forget your password---if you do, you will have  to  ask  the  system
  6109.      administrator  to reset it for you. (If you're the system administrator,
  6110.      see Section 5.4.)
  6111.  
  6112.  
  6113.      4.2.7  Files and directories
  6114.  
  6115.      Under most operating systems (UNIX included), there is the concept of  a
  6116.      file,  which  is  just  a  bundle  of  information which is given a name
  6117.      (called a filename). Examples of files would be your history term paper,
  6118.      an  e-mail  message,  or an actual program which can be executed. Essen¡
  6119.      tially, anything which is saved on disk is saved in an individual  file.
  6120.  
  6121.  
  6122.           Files are identified by their filenames. For example, the file con¡
  6123.      taining your history paper might be saved  with  the  filename  history-
  6124.      paper.   These  names usually identify the file and its contents in some
  6125.      form which is meaningful to you. There is no standard format  for  file¡
  6126.      names  as there is under MS-DOS and other operating systems; in general,
  6127.      filenames may contain any character (except /---see  the  discussion  of
  6128.      pathnames, below), and are limited to 256 characters in length.
  6129.  
  6130.  
  6131.                                 - 95 -
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.           With  the  concept  of  files  comes  the concept of directories. A
  6142.      directory is just a collection of files. It  can  be  thought  of  as  a
  6143.      ``folder''  which  contains many different files. Directories themselves
  6144.      are given names, with which you can identify them.  Furthermore,  direc¡
  6145.      tories are maintained in a tree-like structure; that is, directories may
  6146.      contain other directories.
  6147.  
  6148.  
  6149.           A file may be referred to by its pathname, which is made up of  the
  6150.      filename, preceded by the name of the directory which contains the file.
  6151.      For example, let's say that Larry has a directory called  papers,  which
  6152.      contains  three  files:  history-final, english-lit, and masters-thesis.
  6153.      (Each of these three files contains information  for  three  of  Larry's
  6154.      ongoing  projects.)  To refer to the file english-lit, Larry can specify
  6155.      the file's pathname:
  6156.  
  6157.  
  6158.           papers/english-lit
  6159.  
  6160.  
  6161.  
  6162.  
  6163.           As you can see, the directory and file names  are  separated  by  a
  6164.      single  slash  (/). For this reason, filenames themselves cannot contain
  6165.      the / character.  MS-DOS  users  will  find  this  convention  familiar,
  6166.      although in the MS-DOS world, the backslash (\) is used instead.
  6167.  
  6168.  
  6169.           As  mentioned, directories can be nested within each other as well.
  6170.      For example, let's say that Larry has another directory, within  papers,
  6171.      called  notes.  This  directory contains the files math-notes and cheat-
  6172.      sheet. The pathname of the file cheat-sheet would be
  6173.  
  6174.  
  6175.           papers/notes/cheat-sheet
  6176.  
  6177.  
  6178.  
  6179.  
  6180.           Therefore, the pathname really is a  ``path''  which  you  take  to
  6181.      locate a certain file. The directory above a given subdirectory is known
  6182.      as the parent directory. Here, the directory papers is the parent of the
  6183.      notes directory.
  6184.  
  6185.  
  6186.      4.2.8  The directory tree
  6187.  
  6188.      Most  UNIX  systems  have  a  standard  layout for files, so that system
  6189.      resources and programs can be easily located. This layout forms a direc¡
  6190.      tory tree, which starts at the ``/'' directory, also known as ``the root
  6191.      directory''. Directly underneath / are  some  important  subdirectories:
  6192.      /bin, /etc, /dev, and /usr, among others. These directories in turn con¡
  6193.      tain other directories which contain system  configuration  files,  pro¡
  6194.      grams, and so on.
  6195.  
  6196.  
  6197.                                 - 96 -
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.           In  particular, each user has a home directory, which is the direc¡
  6208.      tory set aside for that user to store his or her files. In the  examples
  6209.      above, all of Larry's files (such as cheat-sheet and history-final) were
  6210.      contained in Larry's home directory. Usually, user home directories  are
  6211.      contained  under  /home, and are named for the user who owns that direc¡
  6212.      tory. Therefore, Larry's home directory is /home/larry.
  6213.  
  6214.  
  6215.      4.2.9  The current working directory
  6216.  
  6217.      At any given time, commands that you type to  the  shell  are  given  in
  6218.      terms  of  your current working directory. You can think of your working
  6219.      directory as the directory in which you are currently ``located''.  When
  6220.      you  first  login,  your  working  directory  is set to your home direc¡
  6221.      tory---/home/larry in our case. Whenever you reference a file,  you  may
  6222.      refer  to  it in relationship to your current working directory, instead
  6223.      of specifying the full pathname of the file.
  6224.  
  6225.  
  6226.           Here's an example. Larry has the directory papers, and papers  con¡
  6227.      tains  the  file  history-final. If Larry wants to look at this file, he
  6228.      can use the command
  6229.  
  6230.  
  6231.           /home/larry# more /home/larry/papers/history-final
  6232.  
  6233.  
  6234.           The more command simply displays a file,  one  screen  at  a  time.
  6235.      However,  because  Larry's  current working directory is /home/larry, he
  6236.      can instead refer to the file relative to his current location. The com¡
  6237.      mand would be
  6238.  
  6239.  
  6240.           /home/larry# more papers/history-final
  6241.  
  6242.  
  6243.           Therefore,  if  you  begin a filename (such as papers/final) with a
  6244.      character other than ``/'', the system assumes that you're referring  to
  6245.      the  file  in terms relative to your current working directory.  This is
  6246.      known as a relative pathname.
  6247.  
  6248.  
  6249.           On the other hand, if you begin a filename with a ``/'', the system
  6250.      interprets  this  as a full pathname---that is, a pathname including the
  6251.      entire path to the file, starting from the root directory, /.   This  is
  6252.      known as an absolute pathname.
  6253.  
  6254.  
  6255.      4.2.10  Referring to home directories
  6256.  
  6257.      Under  both  Tcsh and Bash on Linux, your home directory can be referred
  6258.      to using the tilde character (``~''). For example, the command
  6259.  
  6260.  
  6261.  
  6262.  
  6263.                                 - 97 -
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.           /home/larry# more ~/papers/history-final
  6274.  
  6275.  
  6276.           is equivalent to
  6277.  
  6278.  
  6279.           /home/larry# more /home/larry/papers/history-final
  6280.  
  6281.  
  6282.           The ``~'' character is simply replaced with the name of  your  home
  6283.      directory by the shell.
  6284.  
  6285.  
  6286.           In addition, you can specify other user's home directories with the
  6287.      tilde  as   well.   The   pathname   ``~karl/letters''   translates   to
  6288.      ``/home/karl/letters'' by the shell (if /home/karl is karl's home direc¡
  6289.      tory). The use of the tilde is simply a shortcut; there is no  directory
  6290.      named ``~''---it's just syntactic sugar provided by the shell.
  6291.  
  6292.  
  6293.      4.3  First Steps into UNIX
  6294.  
  6295.      Before we begin, it is important to note that all file and command names
  6296.      on a UNIX system are case-sensitive (unlike operating  systems  such  as
  6297.      MS-DOS).   For  example, the command make is very different than Make or
  6298.      MAKE. The same hold for file and directory names.
  6299.  
  6300.  
  6301.      4.3.1  Moving around
  6302.  
  6303.      Now that we can login, and know how to refer to files  using  pathnames,
  6304.      how can we change our current working directory, to make life easier?
  6305.  
  6306.  
  6307.           The  command  for  moving  around in the directory structure is cd,
  6308.      short for ``change directory''.  You'll notice that many often-used Unix
  6309.      commands are two or three letters.  The usage of the cd command is:
  6310.  
  6311.  
  6312.           cd <directory>
  6313.  
  6314.  
  6315.           where  <directory>  is  the name of the directory which you wish to
  6316.      change to.
  6317.  
  6318.  
  6319.           As we said, when you login, you begin in your  home  directory.  If
  6320.      Larry  wanted  to  move  down into the papers subdirectory, he'd use the
  6321.      command
  6322.  
  6323.  
  6324.           /home/larry# cd papers
  6325.           /home/larry/papers#
  6326.  
  6327.  
  6328.  
  6329.                                 - 98 -
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.           As you can see, Larry's prompt changes to reflect his current work¡
  6340.      ing  directory  (so  he  knows where he is). Now that he's in the papers
  6341.      directory, he can look at his history final with the command
  6342.  
  6343.  
  6344.           /home/larry/papers# more history-final
  6345.  
  6346.  
  6347.  
  6348.  
  6349.           Now, Larry is stuck in the papers subdirectory. To move back up  to
  6350.      the parent directory, use the command
  6351.  
  6352.  
  6353.           /home/larry/papers# cd ..
  6354.           /home/larry#
  6355.  
  6356.           (Note  the  space between the ``cd'' and the ``..''.)  Every direc¡
  6357.      tory has an entry named ``..'' which refers  to  the  parent  directory.
  6358.      Similarly,  every  directory  has  an  entry named ``.'' which refers to
  6359.      itself. Therefore, the command
  6360.  
  6361.  
  6362.           /home/larry/papers# cd .
  6363.  
  6364.  
  6365.           gets us nowhere.
  6366.  
  6367.  
  6368.           You can also use absolute pathnames in the cd command.  To cd  into
  6369.      Karl's home directory, we can use the command
  6370.  
  6371.  
  6372.           /home/larry/papers# cd /home/karl
  6373.           /home/karl#
  6374.  
  6375.  
  6376.  
  6377.           Also,  using  cd  with no argument will return you to your own home
  6378.      directory.
  6379.  
  6380.  
  6381.           /home/karl# cd
  6382.           /home/larry#
  6383.  
  6384.  
  6385.  
  6386.      4.3.2  Looking at the contents of directories
  6387.  
  6388.      Now that you know how to move around  directories  you  probably  think,
  6389.      ``So  what?''   The  basic  skill of moving around directories is fairly
  6390.      useless, so let's introduce a new command, ls. ls prints  a  listing  of
  6391.      files and directories, by default from your current directory. For exam¡
  6392.      ple:
  6393.  
  6394.  
  6395.                                 - 99 -
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.           /home/larry# ls
  6406.           Mail
  6407.           letters
  6408.           papers
  6409.           /home/larry#
  6410.  
  6411.  
  6412.  
  6413.           Here we can see that Larry has three entries in his current  direc¡
  6414.      tory:  Mail,  letters, and papers. This doesn't tell us much---are these
  6415.      directories or files? We can use the -F option on the ls command to tell
  6416.      us more.
  6417.  
  6418.  
  6419.           /home/larry# ls -F
  6420.           Mail/
  6421.           letters/
  6422.           papers/
  6423.           /home/larry#
  6424.  
  6425.           From  the  /  appended  to  each filename, we know that these three
  6426.      entries are in fact subdirectories.
  6427.  
  6428.  
  6429.           Using ls -F may also append ``*'' to the end of a  filename.   This
  6430.      indicates that the file is an executable, or a program which can be run.
  6431.      If nothing is appended to the filename  using  ls  -F,  the  file  is  a
  6432.      ``plain old file'', that is, it's neither a directory, or an executable.
  6433.  
  6434.  
  6435.           In general, each UNIX command may take a number of options in addi¡
  6436.      tion  to  other  arguments. These options usually begin with a ``-'', as
  6437.      demonstrated above with ls -F. The -F  option  tells  ls  to  give  more
  6438.      information  about the type of the files involved---in this case, print¡
  6439.      ing a / after each directory name.
  6440.  
  6441.  
  6442.           If you give ls a directory name, it will print the contents of that
  6443.      directory.
  6444.  
  6445.  
  6446.           /home/larry# ls -F papers
  6447.           english-lit
  6448.           history-final
  6449.           masters-thesis
  6450.           notes/
  6451.           /home/larry#
  6452.  
  6453.  
  6454.  
  6455.           Or,  for  a  more interesting listing, let's see what's in the sys¡
  6456.      tem's /etc directory.
  6457.  
  6458.  
  6459.  
  6460.  
  6461.                                 - 100 -
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.           /home/larry# ls /etc
  6472.  
  6473.           Images          ftpusers        lpc             rc.new          shells
  6474.           adm             getty           magic           rc0.d           startcons
  6475.           bcheckrc        gettydefs       motd            rc1.d           swapoff
  6476.           brc             group           mount           rc2.d           swapon
  6477.           brc~            inet            mtab            rc3.d           syslog.conf
  6478.           csh.cshrc       init            mtools          rc4.d           syslog.pid
  6479.           csh.login       init.d          pac             rc5.d           syslogd.reload
  6480.           default         initrunlvl      passwd          rmt             termcap
  6481.           disktab         inittab         printcap        rpc             umount
  6482.           fdprm           inittab.old     profile         rpcinfo         update
  6483.           fstab           issue           psdatabase      securetty       utmp
  6484.           ftpaccess       lilo            rc              services        wtmp
  6485.           /home/larry#
  6486.  
  6487.  
  6488.  
  6489.  
  6490.           (For those MS-DOS users out there, notice how the filenames can  be
  6491.      longer than 8 characters, and can contain periods in any position. It is
  6492.      even possible to have more than one period in a filename.)
  6493.  
  6494.  
  6495.           Let's cd up to the top of the directory tree, using ``cd ..'',  and
  6496.      then down to another directory: /usr/bin.
  6497.  
  6498.  
  6499.           /home/larry# cd ..
  6500.           /home# cd ..
  6501.           /# cd usr
  6502.           /usr# cd bin
  6503.           /usr/bin#
  6504.  
  6505.           You  can  also  move  into  directories in multiple steps, as in cd
  6506.      /usr/bin.
  6507.  
  6508.  
  6509.           Try moving around various directories, using ls and  cd.   In  some
  6510.      cases,  you  may  run into a foreboding ``Permission denied'' error mes¡
  6511.      sage. This is simply the concept of UNIX security kicking in:  in  order
  6512.      to  ls  or  to  cd  into a directory, you must have permission to do so.
  6513.      We'll talk more about this in Section 4.9.
  6514.  
  6515.  
  6516.      4.3.3  Creating new directories
  6517.  
  6518.      It's time to learn how to create directories. This involves the  use  of
  6519.      the mkdir command. Try the following:
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.                                 - 101 -
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.           /home/larry# mkdir foo
  6538.           /home/larry# ls -F
  6539.           Mail/
  6540.           foo/
  6541.           letters/
  6542.           papers/
  6543.           /home/larry# cd foo
  6544.           /home/larry/foo# ls
  6545.           /home/larry/foo#
  6546.  
  6547.  
  6548.  
  6549.           Congrats!   You've  just  made  a  new directory and moved into it.
  6550.      Since there aren't any files in this new directory, let's learn  how  to
  6551.      copy files from one place to another.
  6552.  
  6553.  
  6554.      4.3.4  Copying files
  6555.  
  6556.      Copying files is done with the command cp:
  6557.  
  6558.  
  6559.           /home/larry/foo# cp /etc/termcap  .
  6560.           /home/larry/foo# cp /etc/shells  .
  6561.           /home/larry/foo# ls -F
  6562.           shells     termcap
  6563.           /home/larry/foo# cp shells bells
  6564.           /home/larry/foo# ls -F
  6565.           bells     shells     termcap
  6566.           /home/larry/foo#
  6567.  
  6568.  
  6569.  
  6570.           The  cp  command copies the files listed on the command line to the
  6571.      file or directory given as the last argument.  Notice  how  we  use  the
  6572.      directory ``.'' to refer to the current directory.
  6573.  
  6574.  
  6575.      4.3.5  Moving files
  6576.  
  6577.      A new command named mv moves files, instead of copying them.  The syntax
  6578.      is very straightforward.
  6579.  
  6580.  
  6581.           /home/larry/foo# mv termcap sells
  6582.           /home/larry/foo# ls -F
  6583.           bells     sells     shells
  6584.           /home/larry/foo#
  6585.  
  6586.  
  6587.  
  6588.           Notice how termcap no longer exists, but in its place is  the  file
  6589.      sells.  This can be used to rename files, as we have just done, but also
  6590.      to move a file to a completely new directory.
  6591.  
  6592.  
  6593.                                 - 102 -
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  <>       Note: mv and cp will overwrite the destination file (if it  already
  6604.      exists) without asking you. Be careful when you move a file into another
  6605.      directory: there may already be a file with the same name in that direc¡
  6606.      tory, which you'll overwrite!
  6607.  
  6608.  
  6609.      4.3.6  Deleting files and directories
  6610.  
  6611.      You  now  have  an ugly rhyme developing with the use of the ls command.
  6612.      To delete a file, use the rm command. (``rm'' stands for ``remove'').
  6613.  
  6614.  
  6615.           /home/larry/foo# rm bells sells
  6616.           /home/larry/foo# ls -F
  6617.           shells
  6618.           /home/larry/foo#
  6619.  
  6620.  
  6621.  
  6622.           We're left with nothing but shells, but  we  won't  complain.  Note
  6623.      that rm by default won't prompt you before deleting a file---so be care¡
  6624.      ful.
  6625.  
  6626.  
  6627.           A related command to rm is rmdir. This command deletes a directory,
  6628.      but  only if the directory is empty. If the directory contains any files
  6629.      or subdirectories, rmdir will complain.
  6630.  
  6631.  
  6632.      4.3.7  Looking at files
  6633.  
  6634.      The commands more and cat are used for viewing the  contents  of  files.
  6635.      more  displays  a  file, one screenful at a time, while cat displays the
  6636.      whole file at once.
  6637.  
  6638.  
  6639.           To look at the file shells, we can use the command
  6640.  
  6641.  
  6642.           /home/larry/foo# more shells
  6643.  
  6644.  
  6645.  
  6646.  
  6647.           In case you're interested what shells  contains,  it's  a  list  of
  6648.      valid  shell  programs  on  your  system. On most systems, this includes
  6649.      /bin/sh, /bin/bash, and /bin/csh. We'll talk about these different types
  6650.      of shells later.
  6651.  
  6652.  
  6653.           While  using  more, press `Space' to display the next page of text,
  6654.      and `b' to display the previous page. There are other commands available
  6655.      in  more  as  well,  these  are just the basics.  Pressing `q' will quit
  6656.      more.
  6657.  
  6658.  
  6659.                                 - 103 -
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.           Quit more and try cat /etc/termcap. The text will probably  fly  by
  6670.      much  too  quickly for you to read it.  The name ``cat'' actually stands
  6671.      for ``concatenate'', which is the real use of the program. The cat  com¡
  6672.      mand  can  be used to concatenate the contents of several files and save
  6673.      the result to another file.  This will be discussed later.
  6674.  
  6675.  
  6676.      4.3.8  Getting online help
  6677.  
  6678.      Almost every UNIX system, Linux included, provides a facility  known  as
  6679.      ``manual  pages'',  or  ``man pages'' for short. These man pages contain
  6680.      online documentation for all of the various system commands,  resources,
  6681.      configuration files, and so on.
  6682.  
  6683.  
  6684.           The command used to access man pages is man. For example, if you're
  6685.      interested in finding out about the other options of the ls command, you
  6686.      can type
  6687.  
  6688.  
  6689.           /home/larry# man ls
  6690.  
  6691.  
  6692.           and the man page for ls will be displayed.
  6693.  
  6694.  
  6695.           Unfortunately,  most  of  the  man  pages out there are written for
  6696.      those who already have some idea of what the command or  resource  does.
  6697.      For  this  reason, man pages usually only contain the hardcore technical
  6698.      details of the command, without a lot of tutorial.  However,  man  pages
  6699.      can  be an invaluable resource for jogging your memory if you forget the
  6700.      syntax of a command. Man pages will also tell you a lot about  the  com¡
  6701.      mands which we won't tell you in this book.
  6702.  
  6703.  
  6704.           I  suggest  that  you  try  man for the commands we've already gone
  6705.      over, and whenever I introduce a new command.   You'll  notice  some  of
  6706.      these commands won't have man pages.  This could be for several reasons.
  6707.      For one, the man pages haven't been written yet (the Linux Documentation
  6708.      Project  is responsible for man pages under Linux as well. We are gradu¡
  6709.      ally accumulating most of the man pages available for the system).  Sec¡
  6710.      ondly,  the  the command might be an internal shell command, or an alias
  6711.      (as discussed in Section 4.2.4), in which case it would not have  a  man
  6712.      page  of  its own. One example is cd, which is a shell internal command.
  6713.      The shell actually processes the cd---there is no separate program which
  6714.      contains this command.
  6715.  
  6716.  
  6717.      4.4  Summary of Basic Commands
  6718.  
  6719.      This section introduces some of the most useful basic commands on a UNIX
  6720.      system, including those covered in the last section.
  6721.  
  6722.  
  6723.  
  6724.  
  6725.                                 - 104 -
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.           Note that options usually begin with a ``-'',  and  in  most  cases
  6736.      multiple  one-letter  options  may be combined using a single ``-''. For
  6737.      example, instead of using the command ls -l -F, it is adequate to use ls
  6738.      -lF.
  6739.  
  6740.  
  6741.           Instead  of  listing all of the options available for each of these
  6742.      commands, we'll only talk about those which are useful or  important  at
  6743.      this  time.   In  fact,  most  of  these commands have a large number of
  6744.      options (most of which you'll never use). You can use  man  to  see  the
  6745.      manual  pages for each command, which list all of the available options.
  6746.  
  6747.  
  6748.           Also note that many of these commands  take  a  list  of  files  or
  6749.      directories  as  arguments, denoted by ``<file1> ...<fileN>''. For exam¡
  6750.      ple, the cp command takes as arguments a list of files to copy, followed
  6751.      by  the  destination file or directory. When copying more than one file,
  6752.      the destination must be a directory.
  6753.  
  6754.  
  6755.  
  6756.  
  6757.  
  6758.              * cd Change the current working directory.
  6759.                Syntax: cd <directory>
  6760.                <directory> is the directory to change to.  (``.''  refers  to
  6761.                the current directory, ``..'' the parent directory.)
  6762.                Example: cd ../foo sets the current directory to ../foo.
  6763.  
  6764.  
  6765.              * ls Displays information about the named files and directories.
  6766.                Syntax: ls <file1> <file2> ...<fileN>
  6767.                Where <file1> through <fileN> are the filenames or directories
  6768.                to  list.   Options:  There  are more options than you want to
  6769.                think about. The most commonly used are -F  (used  to  display
  6770.                some  information about the type of the file), and -l (gives a
  6771.                ``long'' listing including file size, owner, permissions,  and
  6772.                so on. This will be covered in detail later.)
  6773.                Example:  ls  -lF /home/larry will display the contents of the
  6774.                directory /home/larry.
  6775.  
  6776.  
  6777.              * cp Copies file(s) to another file or directory.
  6778.                Syntax: cp <file1> <file2> ...<fileN> <destination>
  6779.                Where <file1> through <fileN> are the files to copy, and <des¡
  6780.                tination> is the destination file or directory.
  6781.                Example: cp ../frog joe copies the file ../frog to the file or
  6782.                directory joe.
  6783.  
  6784.  
  6785.              * mv Moves file(s) to another file or  directory.  This  command
  6786.                does  the equivalent of a copy followed by the deletion of the
  6787.                original. This can be used to rename files, as in  the  MS-DOS
  6788.                command RENAME.
  6789.  
  6790.  
  6791.                                 - 105 -
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.                Syntax: mv <file1> <file2> ...<fileN> <destination>
  6802.                Where <file1> through <fileN> are the files to move, and <des¡
  6803.                tination> is the destination file or directory.
  6804.                Example: mv ../frog joe moves the file ../frog to the file  or
  6805.                directory joe.
  6806.  
  6807.  
  6808.              * rm Deletes files. Note that when files are deleted under UNIX,
  6809.                they are unrecoverable (unlike MS-DOS, where you  can  usually
  6810.                ``undelete'' the file).
  6811.                Syntax: rm <file1> <file2> ...<fileN>
  6812.                Where <file1> through <fileN> are the filenames to delete.
  6813.                Options:  -i  will prompt for confirmation before deleting the
  6814.                file.
  6815.                Example: rm -i /home/larry/joe  /home/larry/frog  deletes  the
  6816.                files joe and frog in /home/larry.
  6817.  
  6818.  
  6819.              * mkdir Creates new directories.
  6820.                Syntax: mkdir <dir1> <dir2> ...<dirN>
  6821.                Where <dir1> through <dirN> are the directories to create.
  6822.                Example:  mkdir  /home/larry/test  creates  the directory test
  6823.                under /home/larry.
  6824.  
  6825.  
  6826.              * rmdir This  command  deletes  empty  directories.  When  using
  6827.                rmdir,  your  current working directory must not be within the
  6828.                directory to be deleted.
  6829.                Syntax: rmdir <dir1> <dir2> ...<dirN>
  6830.                Where <dir1> through <dirN> are the directories to delete.
  6831.                Example:  rmdir  /home/larry/papers  deletes   the   directory
  6832.                /home/larry/papers, if it is empty.
  6833.  
  6834.  
  6835.              * man Displays the manual page for the given command or resource
  6836.                (that is, any system utility which isn't a command, such as  a
  6837.                library function.)  Syntax: man <command>
  6838.                Where  <command> is the name of the command or resource to get
  6839.                help on.
  6840.                Example: man ls gives help on the ls command.
  6841.  
  6842.  
  6843.              * more Displays the contents of the named files,  one  screenful
  6844.                at a time.
  6845.                Syntax: more <file1> <file2> ...<fileN>
  6846.                Where <file1> through <fileN> are the files to display.
  6847.                Example:   more   papers/history-final   displays   the   file
  6848.                papers/history-final.
  6849.  
  6850.  
  6851.              * cat Officially used to concatenate files, cat is also used  to
  6852.                display the entire contents of a file at once.
  6853.                Syntax: cat <file1> <file2> ...<fileN>
  6854.                Where <file1> through <fileN> are the files to display.
  6855.  
  6856.  
  6857.                                 - 106 -
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.                Example:  cat letters/from-mdw displays the file letters/from-
  6868.                mdw.
  6869.  
  6870.  
  6871.              * echo Simply echoes the given arguments.
  6872.                Syntax: echo <arg1> <arg2> ...<argN>
  6873.                Where <arg1> through <argN> are the arguments to echo.
  6874.                Example:  echo  "Hello  world"  displays  the  string  ``Hello
  6875.                world''.
  6876.  
  6877.  
  6878.              * grep  Display  all  of the lines in the named file(s) matching
  6879.                the given pattern.
  6880.                Syntax: grep <pattern> <file1> <file2> ...<fileN>
  6881.                Where <pattern> is a regular expression pattern,  and  <file1>
  6882.                through <fileN> are the files to search.
  6883.                Example:  grep loomer /etc/hosts will display all lines in the
  6884.                file /etc/hosts which contain the pattern ``loomer''.
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.      4.5  Exploring the File System
  6891.  
  6892.      The file system is the collection of files and the hierarchy of directo¡
  6893.      ries on your system. I promised before to escort you around the filesys¡
  6894.      tem and the time has come.
  6895.  
  6896.  
  6897.           First, change to the root directory  (cd  /),  and  do  an  ls  -F.
  6898.      You'll probably see these directories(1) : bin, dev, etc, home, install,
  6899.      lib, mnt, proc, root, tmp, user, usr, and var.
  6900.  
  6901.  
  6902.           Let's take a look at each of these directories.
  6903.  
  6904.  
  6905.  
  6906.  
  6907.              * /bin /bin is short for ``binaries'', or executables.  This  is
  6908.                where  many essential system programs reside.  Use the command
  6909.                ``ls -F /bin'' to list the files here.  If you look  down  the
  6910.                list  you  may  see a few commands that you recognize, such as
  6911.                cp, ls, and mv. These are the actual programs for  these  com¡
  6912.                mands. When you use the cp command, you're running the program
  6913.                /bin/cp.
  6914.  
  6915.  
  6916.                     Using ls -F, you'll see that most (if  not  all)  of  the
  6917.  
  6918.      
  6919.  
  6920.      1. You  may  see  others, and you might not see all of them.
  6921.         Don't worry. Every  release  of  Linux  differs  in  some
  6922.         respects.
  6923.  
  6924.                                 - 107 -
  6925.  
  6926.  
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.                files in /bin have an asterisk (``*'') appended to their file¡
  6935.                names.  This indicates that  the  files  are  executables,  as
  6936.                described in Section 4.3.2.
  6937.  
  6938.  
  6939.              * /dev  Next on our stop is /dev. Take a look, again with ls -F.
  6940.  
  6941.  
  6942.                     The ``files'' in /dev are known as device  drivers---they
  6943.                are  used to access system devices and resources, such as disk
  6944.                drives, modems, memory, and so on. For example,  just  as  you
  6945.                can  read  data from a file, you can read input from the mouse
  6946.                by accessing /dev/mouse.
  6947.  
  6948.  
  6949.                     The filenames beginning with fd are floppy disk  devices.
  6950.                fd0  is the first floppy disk drive, fd1 the second.  Now, the
  6951.                astute among you will notice that there are more  floppy  disk
  6952.                devices  then  just  the two I've listed above: they represent
  6953.                specific types of floppy disks.  For  example,  fd1H1440  will
  6954.                access high-density, 3.5" diskettes in drive 1.
  6955.  
  6956.  
  6957.                     Here  is  a list of some of the most commonly used device
  6958.                files. Note that even though you may  not  have  some  of  the
  6959.                devices listed below, the chances are that you'll have entries
  6960.                in /dev for them anyway.
  6961.  
  6962.  
  6963.  
  6964.  
  6965.                        * /dev/console refers to the  system's  console---that
  6966.                          is, the monitor connected directly to your system.
  6967.  
  6968.  
  6969.                        * The  various /dev/ttyS and /dev/cua devices are used
  6970.                          for accessing serial ports. For example,  /dev/ttyS0
  6971.                          refers   to  ``COM1''  under  MS-DOS.  The  /dev/cua
  6972.                          devices are ``callout'' devices, which are  used  in
  6973.                          conjunction with a modem.
  6974.  
  6975.  
  6976.                        * The  device  names  beginning  with  hd  access hard
  6977.                          drives.  /dev/hda refers to  the  whole  first  hard
  6978.                          disk,  while  hda1  refers to the first partition on
  6979.                          /dev/hda.
  6980.  
  6981.  
  6982.                        * The device names beginning with sd are SCSI  drives.
  6983.                          If  you have a SCSI hard drive, instead of accessing
  6984.                          it through /dev/hda, you would access /dev/sda. SCSI
  6985.                          tapes  are  accessed via st devices, and SCSI CD-ROM
  6986.                          via sr devices.
  6987.  
  6988.  
  6989.  
  6990.                                 - 108 -
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.                        * The device names beginning with lp  access  parallel
  7001.                          ports.   /dev/lp0  refers  to ``LPT1'' in the MS-DOS
  7002.                          world.
  7003.  
  7004.  
  7005.                        * /dev/null is used as  a  ``black  hole''---any  data
  7006.                          sent  to  this  device  is gone forever. Why is this
  7007.                          useful? Well, if you wanted to suppress  the  output
  7008.                          of  a  command  appearing  on your screen, you could
  7009.                          send that output to /dev/null. We'll talk more about
  7010.                          this later.
  7011.  
  7012.  
  7013.                        * The  device  names  beginning with /dev/tty refer to
  7014.                          the ``virtual consoles'' on  your  system  (accessed
  7015.                          via  by  pressing  `alt-F1',  `alt-F2',  and so on).
  7016.                          /dev/tty1 refers to the first VC,  /dev/tty2  refers
  7017.                          to the second, and so on.
  7018.  
  7019.  
  7020.                        * The   device   names  beginning  with  /dev/pty  are
  7021.                          ``pseudo-terminals''.  They are used  to  provide  a
  7022.                          ``terminal''  to remote login sessions. For example,
  7023.                          if your machine is on  a  network,  incoming  telnet
  7024.                          logins would use one of the /dev/pty devices.
  7025.  
  7026.  
  7027.  
  7028.              * /etc  /etc contains just about everything which can be labeled
  7029.                ``et cetera''---many system configuration files, programs, and
  7030.                utilities.   Most of the programs found in /etc are for use by
  7031.                the system administrator only. We'll cover these in  depth  in
  7032.                Chapter 5..
  7033.  
  7034.  
  7035.              * /home  /home  contains  user's  home directories. For example,
  7036.                /home/larry is the home directory for the user ``larry''. On a
  7037.                newly-installed  system,  there  may  not be any users in this
  7038.                directory.
  7039.  
  7040.  
  7041.              * /lib /lib contains shared library images. These files  contain
  7042.                code which many programs share in common. Instead of each pro¡
  7043.                gram containing its own copy of these  shared  routines,  they
  7044.                are  all  stored in one common place, in /lib. This makes exe¡
  7045.                cutable files smaller, and saves space on your system.
  7046.  
  7047.  
  7048.              * /proc /proc is a ``virtual filesystem'', the  files  in  which
  7049.                are stored in memory, not on the drive. They refer to the var¡
  7050.                ious processes running on the system, and  allow  you  to  get
  7051.                information  about  what programs and processes are running at
  7052.                any given time. We'll go into more detail in Section 4.10.1.
  7053.  
  7054.  
  7055.  
  7056.                                 - 109 -
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.              * /tmp Many programs have a need to  generate  some  information
  7067.                and  store  it in a temporary file. The canonical location for
  7068.                these files is in /tmp.
  7069.  
  7070.  
  7071.              * /usr /usr is a very important directory. It contains a  number
  7072.                of  subdirectories  which  in  turn  contain  some of the most
  7073.                important and useful programs and configuration files used  on
  7074.                the system.
  7075.  
  7076.  
  7077.                     The various directories described above are essential for
  7078.                the system to operate, but most of the things  found  in  /usr
  7079.                are  optional  for  the  system. However, it is those optional
  7080.                things which make the system useful and  interesting.  Without
  7081.                /usr,  you'd more or less have a boring system, only with pro¡
  7082.                grams like cp and ls.  /usr contains most of the larger  soft¡
  7083.                ware  packages  and  the  configuration  files which accompany
  7084.                them.
  7085.  
  7086.  
  7087.              * /usr/X386 /usr/X386 contains  The  X  Window  System,  if  you
  7088.                installed it.  The X Window System is a large, powerful graph¡
  7089.                ical environment which provides a large  number  of  graphical
  7090.                utilities  and  programs,  displayed  in  ``windows''  on your
  7091.                screen. If you're at all familiar with the  Microsoft  Windows
  7092.                or  Macintosh environments, X Windows will look very familiar.
  7093.                The /usr/X386 directory contains all of the X Windows executa¡
  7094.                bles,  configuration  files,  and  support files. This will be
  7095.                covered in more detail in Section 6.1.
  7096.  
  7097.  
  7098.              * /usr/adm /usr/adm contains various files of  interest  to  the
  7099.                system  administrator,  specifically system logs, which record
  7100.                any errors or problems with the  system.  Other  files  record
  7101.                logins  to  the system, as well as failed login attempts. This
  7102.                will be covered in Chapter 5..
  7103.  
  7104.  
  7105.              * /usr/bin /usr/bin is the real warehouse for  software  on  any
  7106.                UNIX system.  It contains most of the executables for programs
  7107.                not found in other places, such as /bin.
  7108.  
  7109.  
  7110.              * /usr/etc Just as /etc contained miscellaneous system  programs
  7111.                and  configuration files, /usr/etc contains even more of these
  7112.                utilities and files.  In general, the files found in  /usr/etc
  7113.                are  not  essential to the system, unlike those found in /etc,
  7114.                which are.
  7115.  
  7116.  
  7117.              * /usr/include /usr/include contains include  files  for  the  C
  7118.                compiler.    These  files  (most  of  which  end  in  .h,  for
  7119.                ``header'') declare data  structure  names,  subroutines,  and
  7120.  
  7121.  
  7122.                                 - 110 -
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.                constants  used  when writing programs in C. Those files found
  7133.                in /usr/include/sys are generally used when programming on the
  7134.                UNIX  system level. If you are familiar with the C programming
  7135.                language, here you'll find header files such as stdio.h, which
  7136.                declares functions such as printf().
  7137.  
  7138.  
  7139.              * /usr/g++-include  /usr/g++-include  contains include files for
  7140.                the C++ compiler (much like /usr/include).
  7141.  
  7142.  
  7143.              * /usr/lib /usr/lib contains the ``stub'' and ``static'' library
  7144.                equivalents  to the files found in /lib. When compiling a pro¡
  7145.                gram, the program is ``linked'' with the  libraries  found  in
  7146.                /usr/lib,  which then directs the program to look in /lib when
  7147.                it needs the actual code in the library. In addition,  various
  7148.                other programs store configuration files in /usr/lib.
  7149.  
  7150.  
  7151.              * /usr/local /usr/local is a lot like /usr---it contains various
  7152.                programs and files not essential to the system, but which make
  7153.                the  system fun and exciting. In general, those programs found
  7154.                in  /usr/local  are  specialized  for  your  system   specifi¡
  7155.                cally---that  is, /usr/local differs greatly between UNIX sys¡
  7156.                tems.
  7157.  
  7158.  
  7159.                     Here, you'll find large software packages such as TeX  (a
  7160.                document  formatting  system)  and Emacs (a large and powerful
  7161.                editor), if you installed them.
  7162.  
  7163.  
  7164.              * /usr/man This directory contains the actual man  pages.  There
  7165.                are two subdirectories for every man page ``section'' (use the
  7166.                command man man for details).  For example, /usr/man/man1 con¡
  7167.                tains  the  source (that is, the unformatted original) for man
  7168.                pages in section 1, and /usr/man/cat1 contains  the  formatted
  7169.                man pages for section 1.
  7170.  
  7171.  
  7172.              * /usr/spool   /usr/spool   contains   files  which  are  to  be
  7173.                ``spooled'' to another program. For example, if  your  machine
  7174.                is  connected  to  a  network, incoming mail will be stored in
  7175.                /usr/spool/mail, until you read it or delete it.  Outgoing  or
  7176.                incoming news articles may be found in /usr/spool/news, and so
  7177.                on.
  7178.  
  7179.  
  7180.              * /usr/src /usr/src contains the  source  code  (the  uncompiled
  7181.                program)  for various programs on your system. The most impor¡
  7182.                tant thing here is /usr/src/linux, which contains  the  source
  7183.                code for the Linux kernel.
  7184.  
  7185.  
  7186.  
  7187.  
  7188.                                 - 111 -
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.      4.6  Types of shells
  7199.  
  7200.      As  I have mentioned too many times before, UNIX is a multitasking, mul¡
  7201.      tiuser operating system.  Multitasking is very useful, and once you  get
  7202.      used  to  it, you'll use it all of the time. Before long, you'll be able
  7203.      to run programs in the ``background'', switch  between  multiple  tasks,
  7204.      and ``pipeline'' programs together to achieve complicated results with a
  7205.      single command.
  7206.  
  7207.  
  7208.           Many of the features we'll be covering in this section are features
  7209.      provided by the shell itself. Be careful not to confuse UNIX (the actual
  7210.      operating system) with the shell---the shell is just an interface to the
  7211.      underlying  system.  The shell provides a great deal of functionality on
  7212.      top of UNIX itself.
  7213.  
  7214.  
  7215.           The shell is not only an interpreter for your interactive commands,
  7216.      which  you  type  at  the prompt. It is also a powerful programming lan¡
  7217.      guage, which allows you to write shell  scripts,  to  ``batch''  several
  7218.      shell commands together in a file. MS-DOS users will recognize the simi¡
  7219.      larity to ``batch files''.  Use of shell  scripts  is  a  very  powerful
  7220.      tool, which will allow you to automate and expand you usage of UNIX. See
  7221.      Section 4.12.1 for more information.
  7222.  
  7223.  
  7224.           There are several types of shells in the UNIX world. The two  major
  7225.      types  are  the  ``Bourne  shell'' and the ``C shell''. The Bourne shell
  7226.      uses a command syntax like the original shell  on  early  UNIX  systems,
  7227.      such as System III. The name of the Bourne shell on most UNIX systems is
  7228.      /bin/sh (where sh stands for ``shell''). The C shell (not to be confused
  7229.      with  sea  shell) uses a different syntax, somewhat like the programming
  7230.      language C, and on most UNIX systems is named /bin/csh.
  7231.  
  7232.  
  7233.           Under Linux, there are several variations of  these  shells  avail¡
  7234.      able.   The  two  most  commonly  used  are  the  Bourne Again Shell, or
  7235.      ``Bash'' (/bin/bash), and Tcsh (/bin/tcsh). Bash is a form of the Bourne
  7236.      shell  with  many of the advanced features found in the C shell. Because
  7237.      Bash supports a superset of the Bourne shell syntax, any  shell  scripts
  7238.      written  in  the standard Bourne shell should work with Bash.  For those
  7239.      who prefer to use the C shell syntax, Linux supports Tcsh, which  is  an
  7240.      expanded version of the original C shell.
  7241.  
  7242.  
  7243.           The  type  of  shell  that  you decide to use is mostly a religious
  7244.      issue.  Some folks prefer the Bourne shell syntax with the advanced fea¡
  7245.      tures  of  Bash,  and some prefer the more structured C shell syntax. As
  7246.      far as normal commands, such as cp and ls, are concerned,  the  type  of
  7247.      shell  you're  using doesn't matter---the syntax is the same.  Only when
  7248.      you start to write shell scripts or use some of the advanced features of
  7249.      the shell do the differences between shell types begin to matter.
  7250.  
  7251.  
  7252.  
  7253.  
  7254.                                 - 112 -
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.           As we're discussing some of the features of the shell, below, we'll
  7265.      note those differences between Bourne and C  shells.  However,  for  the
  7266.      purposes  of  this  manual,  most of those differences are minimal.  (If
  7267.      you're really curious at this point, read the man  pages  for  bash  and
  7268.      tcsh).
  7269.  
  7270.  
  7271.      4.7  Wildcards
  7272.  
  7273.      A  key feature of most Unix shells is the ability to reference more than
  7274.      one filename using special characters. These so-called  wildcards  allow
  7275.      you to refer to, say, all filenames which contain the character ``n''.
  7276.  
  7277.  
  7278.           The  wildcard ``*'' refers to any character or string of characters
  7279.      in a filename. For example, when you use the character ``*'' in a  file¡
  7280.      name,  the  shell replaces it with all possible substitutions from file¡
  7281.      names in the directory which you're referencing.
  7282.  
  7283.  
  7284.           Here's a quick example. Let's suppose  that  Larry  has  the  files
  7285.      frog, joe, and stuff in his current directory.
  7286.  
  7287.  
  7288.           /home/larry# ls
  7289.           frog     joe     stuff
  7290.           /home/larry#
  7291.  
  7292.  
  7293.  
  7294.           To  access  all files with the letter ``o'' in the filename, we can
  7295.      use the command
  7296.  
  7297.  
  7298.           /home/larry# ls *o*
  7299.           frog     joe
  7300.           /home/larry#
  7301.  
  7302.           As you can see, the use of the ``*'' wildcard was replaced with all
  7303.      substitutions  which  matched the wildcard from filenames in the current
  7304.      directory.
  7305.  
  7306.  
  7307.           The use of ``*'' by itself simply matches  all  filenames,  because
  7308.      all characters match the wildcard.
  7309.  
  7310.  
  7311.           /home/larry# ls *
  7312.           frog     joe     stuff
  7313.           /home/larry#
  7314.  
  7315.  
  7316.  
  7317.           Here are a few more examples.
  7318.  
  7319.  
  7320.                                 - 113 -
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.           /home/larry# ls f*
  7331.           frog
  7332.           /home/larry# ls *ff
  7333.           stuff
  7334.           /home/larry# ls *f*
  7335.           frog     stuff
  7336.           /home/larry# ls s*f
  7337.           stuff
  7338.           /home/larry#
  7339.  
  7340.  
  7341.  
  7342.           The  process  of changing a ``*'' into filenames is called wildcard
  7343.      expansion and is done by the shell. This is  important:  the  individual
  7344.      commands,  such  as ls, never see the ``*'' in their list of parameters.
  7345.      The shell expands the wildcard to include all  of  the  filenames  which
  7346.      match. So, the command
  7347.  
  7348.  
  7349.           /home/larry# ls *o*
  7350.  
  7351.  
  7352.           is expanded by the shell to actually be
  7353.  
  7354.  
  7355.           /home/larry# ls frog joe
  7356.  
  7357.  
  7358.  
  7359.  
  7360.           One  important  note  about the ``*'' wildcard. Using this wildcard
  7361.      will not match filenames which  begin  with  a  single  period  (``.'').
  7362.      These  files  are  treated as "hidden" files---while they are not really
  7363.      hidden, they don't show up on normal ls listings, and aren't touched  by
  7364.      the use of the ``*'' wildcard.
  7365.  
  7366.  
  7367.           Here's an example. We already mentioned that each directory has two
  7368.      special entries in it: ``.'' refers to the current directory, and ``..''
  7369.      refers  to  the  parent  directory.  However, when you use ls, these two
  7370.      entries don't show up.
  7371.  
  7372.  
  7373.           /home/larry# ls
  7374.           frog     joe     stuff
  7375.           /home/larry#
  7376.  
  7377.           If you use the -a switch with ls, however, you  can  display  file¡
  7378.      names which begin with ``.''. Observe:
  7379.  
  7380.  
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.                                 - 114 -
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.           /home/larry# ls -a
  7397.           .     ..     .bash profile     .bashrc     frog
  7398.                joe     stuff
  7399.           /home/larry#
  7400.  
  7401.           Now  we  can see the two special entries, ``.'' and ``..'', as well
  7402.      as two other ``hidden'' files---.bash profile  and  .bashrc.  These  two
  7403.      files are startup files used by bash when larry logs in. More on them in
  7404.      Section 4.12.3.
  7405.  
  7406.  
  7407.           Note that when we use the ``*'' wildcard,  none  of  the  filenames
  7408.      beginning with ``.'' are displayed.
  7409.  
  7410.  
  7411.           /home/larry# ls *
  7412.           frog     joe     stuff
  7413.           /home/larry#
  7414.  
  7415.           This  is  a safety feature: if the ``*'' wildcard matched filenames
  7416.      beginning with ``.'', it would also match the directory names ``.''  and
  7417.      ``..''. This can be dangerous when using certain commands.
  7418.  
  7419.  
  7420.           Another  wildcard  is ``?''.  The ``?'' wildcard will only expand a
  7421.      single character. Thus, ``ls ?'' will display all  one  character  file¡
  7422.      names,  and  ``ls  termca?''  would  display ``termcap'' but not ``term¡
  7423.      cap.backup''.  Here's another example:
  7424.  
  7425.  
  7426.           /home/larry# ls j?e
  7427.           joe
  7428.           /home/larry# ls f??g
  7429.           frog
  7430.           /home/larry# ls ????f
  7431.           stuff
  7432.           /home/larry#
  7433.  
  7434.  
  7435.  
  7436.           As you can see, wildcards allow you to specify many  files  at  one
  7437.      time.   In  the simple command summary, in Section 4.4, we said that the
  7438.      cp and mv commands actually can copy or move multiple files at one time.
  7439.      For example,
  7440.  
  7441.  
  7442.           /home/larry# cp /etc/s* /home/larry
  7443.  
  7444.  
  7445.           will  copy all filenames in /etc beginning with ``s'' to the direc¡
  7446.      tory /home/larry. Therefore, the format of the cp command is really
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.                                 - 115 -
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.           cp <file1> <file2> <file3> ...<fileN> <destination>
  7463.  
  7464.  
  7465.           where <file1> through <fileN> is a list of filenames to  copy,  and
  7466.      <destination>  is  the destination file or directory to copy them to. mv
  7467.      has an identical syntax.
  7468.  
  7469.  
  7470.           Note that if you are copying or moving  more  than  one  file,  the
  7471.      <destination>  must  be  a directory. You can only copy or move a single
  7472.      file to another file.
  7473.  
  7474.  
  7475.      4.8  UNIX Plumbing
  7476.  
  7477.  
  7478.  
  7479.  
  7480.      4.8.1  Standard input and output
  7481.  
  7482.      Many UNIX commands get input from what is known as  standard  input  and
  7483.      send their output to standard output (often abbreviated as ``stdin'' and
  7484.      ``stdout''). Your shell sets things up so that standard  input  is  your
  7485.      keyboard, and standard output is the screen.
  7486.  
  7487.  
  7488.           Here's  an  example using the command cat. Normally, cat reads data
  7489.      from all of the filenames given on the command line and sends this  data
  7490.      directly to stdout. Therefore, using the command
  7491.  
  7492.  
  7493.           /home/larry/papers# cat history-final masters-thesis
  7494.  
  7495.  
  7496.           will  display  the  contents  of the file history-final followed by
  7497.      masters-thesis.
  7498.  
  7499.  
  7500.           However, if no filenames are given to cat as parameters, it instead
  7501.      reads data from stdin, and sends it back to stdout. Here's an example.
  7502.  
  7503.  
  7504.           /home/larry/papers# cat
  7505.           Hello there.
  7506.           Hello there.
  7507.           Bye.
  7508.           Bye.
  7509.           `ctrl-D'
  7510.           /home/larry/papers#
  7511.  
  7512.           As  you  can see, each line that the user types (displayed in ital¡
  7513.      ics) is immediately echoed back by the cat command.  When  reading  from
  7514.      standard  input,  commands know that the input is ``finished'' when they
  7515.      receive an EOT (end-of-text) signal. In general, this  is  generated  by
  7516.  
  7517.  
  7518.                                 - 116 -
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.      pressing `ctrl-D'.
  7529.  
  7530.  
  7531.           Here's  another  example.  The  command sort reads in lines of text
  7532.      (again, from stdin, unless files are given on  the  command  line),  and
  7533.      sends the sorted output to stdout. Try the following.
  7534.  
  7535.  
  7536.           /home/larry/papers# sort
  7537.           bananas
  7538.           carrots
  7539.           apples
  7540.           `ctrl-D'
  7541.           apples
  7542.           bananas
  7543.           carrots
  7544.           /home/larry/papers#
  7545.  
  7546.           Now we can alphabetize our shopping list... isn't UNIX useful?
  7547.  
  7548.  
  7549.      4.8.2  Redirecting input and output
  7550.  
  7551.      Now,  let's  say that we wanted to send the output of sort to a file, to
  7552.      save our shopping list elsewhere. The shell allows us to redirect  stan¡
  7553.      dard  output to a filename, using the ``>'' symbol. Here's how it works.
  7554.  
  7555.  
  7556.           /home/larry/papers# sort > shopping-list
  7557.           bananas
  7558.           carrots
  7559.           apples
  7560.           `ctrl-D'
  7561.           /home/larry/papers#
  7562.  
  7563.           As you can see, the result of the  sort  command  isn't  displayed,
  7564.      instead  it's saved to the file shopping-list.  Let's look at this file.
  7565.  
  7566.  
  7567.           /home/larry/papers# cat shopping-list
  7568.           apples
  7569.           bananas
  7570.           carrots
  7571.           /home/larry/papers#
  7572.  
  7573.           Now we can sort our shopping list, and save  it,  too!   But  let's
  7574.      suppose that we were storing our unsorted, original shopping list in the
  7575.      file items. One way of sorting the information and saving it to  a  file
  7576.      would  be to give sort the name of the file to read, in lieu of standard
  7577.      input, and redirect standard output as we did above. As so:
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.                                 - 117 -
  7585.  
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.           /home/larry/papers# sort items > shopping-list
  7595.           /home/larry/papers# cat shopping-list
  7596.           apples
  7597.           bananas
  7598.           carrots
  7599.           /home/larry/papers#
  7600.  
  7601.           However, there's another way of doing this. Not only can  we  redi¡
  7602.      rect  standard output, but we can redirect standard input as well, using
  7603.      the ``<'' symbol.
  7604.  
  7605.  
  7606.           /home/larry/papers# sort < items
  7607.           apples
  7608.           bananas
  7609.           carrots
  7610.           /home/larry/papers#
  7611.  
  7612.           Technically, sort < items is equivalent to sort items, but the for¡
  7613.      mer  allows  us to demonstrate the point: sort < items behaves as if the
  7614.      data in the file items was typed to standard input.  The  shell  handles
  7615.      the redirection. sort wasn't given the name of the file (items) to read;
  7616.      as far as sort is concerned, it was still reading from standard input as
  7617.      if you had typed the data from your keyboard.
  7618.  
  7619.  
  7620.           This  introduces  the  concept  of  a filter. A filter is a program
  7621.      which reads data from standard input, processes  it  in  some  way,  and
  7622.      sends the processed data to standard output. Using redirection, standard
  7623.      input and/or standard output can be referenced from files.   sort  is  a
  7624.      simple  filter: it sorts the incoming data and sends the result to stan¡
  7625.      dard output. cat is even simpler: it doesn't do anything with the incom¡
  7626.      ing data, it simply outputs whatever was given to it.
  7627.  
  7628.  
  7629.      4.8.3  Using pipes
  7630.  
  7631.      We've  already  demonstrated how to use sort as a filter. However, these
  7632.      examples assumed that you had data in a file somewhere, or were  willing
  7633.      to type the data to standard input yourself. What if the data you wanted
  7634.      to sort came from the output of another command, such as ls?  For  exam¡
  7635.      ple,  using  the  -r  option  with  sort  sorts  the  data  in  reverse-
  7636.      alphabetical order. If you wanted to list  the  files  in  your  current
  7637.      directory in reverse order, one way to do it would be:
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.                                 - 118 -
  7651.  
  7652.  
  7653.  
  7654.  
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660.           /home/larry/papers# ls
  7661.           english-list
  7662.           history-final
  7663.           masters-thesis
  7664.           notes
  7665.           /home/larry/papers# ls > file-list
  7666.           /home/larry/papers# sort -r file-list
  7667.           notes
  7668.           masters-thesis
  7669.           history-final
  7670.           english-list
  7671.           /home/larry/papers#
  7672.  
  7673.           Here,  we saved the output of ls in a file, and then ran sort -r on
  7674.      that file. But this is unwieldy and causes us to use a temporary file to
  7675.      save the data from ls.
  7676.  
  7677.  
  7678.           The solution is to use pipelining. Pipelining is another feature of
  7679.      the shell which allows  you  to  connect  a  string  of  commands  in  a
  7680.      ``pipe'',  where the stdout of the first command is sent directly to the
  7681.      stdin of the second command, and so on.  Here, we wish to send the  std¡
  7682.      out  of  ls  to the stdin of sort.  The ``|'' symbol is used to create a
  7683.      pipe:
  7684.  
  7685.  
  7686.  
  7687.           /home/larry/papers# ls | sort -r
  7688.           notes
  7689.           masters-thesis
  7690.           history-final
  7691.           english-list
  7692.           /home/larry/papers#
  7693.  
  7694.           This command is much shorter, and obviously easier to type.
  7695.  
  7696.  
  7697.           Another useful example---using the command
  7698.  
  7699.  
  7700.           /home/larry/papers# ls /usr/bin
  7701.  
  7702.  
  7703.           is going to display a long list a files, most  of  which  will  fly
  7704.      past  the  screen  too  quickly for you to read them. Instead, let's use
  7705.      more to display the list of files in /usr/bin.
  7706.  
  7707.  
  7708.           /home/larry/papers# ls /usr/bin | more
  7709.  
  7710.  
  7711.           Now you can page down the list of files at your own leisure.
  7712.  
  7713.  
  7714.  
  7715.  
  7716.                                 - 119 -
  7717.  
  7718.  
  7719.  
  7720.  
  7721.  
  7722.  
  7723.  
  7724.  
  7725.  
  7726.           But the fun doesn't stop here! We can pipe more than  two  commands
  7727.      together.   The  command head is a filter which displays the first lines
  7728.      from an input stream (here, input from a pipe). If we wanted to  display
  7729.      the last filename in alphabetical order in the current directory, we can
  7730.      use:
  7731.  
  7732.  
  7733.           /home/larry/papers# ls | sort -r | head -1
  7734.           notes
  7735.           /home/larry/papers#
  7736.  
  7737.           where head -1 simply displays the  first  line  of  input  that  it
  7738.      receives (in this case, the stream of reverse-sorted data from ls).
  7739.  
  7740.  
  7741.      4.8.4  Non-destructive redirection
  7742.  
  7743.      Using ``>'' to redirect output to a file is destructive: in other words,
  7744.      the command
  7745.  
  7746.  
  7747.           /home/larry/papers# ls > file-list
  7748.  
  7749.  
  7750.           overwrites the contents of the file  file-list.  If,  instead,  you
  7751.      redirect  with  the  symbol  ``>>'',  the output will be appended to the
  7752.      named file, instead of overwriting it.
  7753.  
  7754.  
  7755.           /home/larry/papers# ls >> file-list
  7756.  
  7757.  
  7758.           will append the output of the ls command to file-list.
  7759.  
  7760.  
  7761.           Just keep in mind that redirection and  using  pipes  are  features
  7762.      provided by the shell---the shell provides this handy syntax using ``>''
  7763.      and ``>>'' and ``|''. It has nothing to do with the commands used  them¡
  7764.      selves, but the shell.
  7765.  
  7766.  
  7767.      4.9  File Permissions
  7768.  
  7769.      4.9.1  Concepts of file permissions
  7770.  
  7771.      Because  there  are multiple users on a UNIX system, in order to protect
  7772.      individual user's files from tampering by other users, UNIX  provides  a
  7773.      mechanism  known  as  file  permissions. This mechanism allows files and
  7774.      directories to be ``owned'' by a particular user. As an example, because
  7775.      Larry  created  the files in his home directory, Larry owns those files,
  7776.      and has access to them.
  7777.  
  7778.  
  7779.           UNIX also allows files to be shared between  users  and  groups  of
  7780.  
  7781.  
  7782.                                 - 120 -
  7783.  
  7784.  
  7785.  
  7786.  
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792.      users.   If Larry so desired, he could cut off access to his files, such
  7793.      that no other user could access  them.  However,  on  most  systems  the
  7794.      default  is  to  allow other users to read your files, but not modify or
  7795.      delete them in any way.
  7796.  
  7797.  
  7798.           As explained above, every file is owned by a particular user.  How¡
  7799.      ever,  files  are  also  owned by a particular group, which is a system-
  7800.      defined group of users. Every user is placed into  at  least  one  group
  7801.      when  that  user  is created. However, the system administrator may also
  7802.      grant the user access to more than one group.
  7803.  
  7804.  
  7805.           Groups are usually defined by the type of users  which  access  the
  7806.      machine.   For example, on a university UNIX system, users may be placed
  7807.      into the groups student, staff, faculty or guest. There are also  a  few
  7808.      system-defined groups (such as bin and admin) which are used by the sys¡
  7809.      tem itself to control access to resources---very rarely do actual  users
  7810.      belong to these system groups.
  7811.  
  7812.  
  7813.           Permissions  fall  into three main divisions: read, write, and exe¡
  7814.      cute.  These permissions may be granted to three classes of  users:  the
  7815.      owner  of  the  file,  the  group  to which the file belongs, and to all
  7816.      users, regardless of group.
  7817.  
  7818.  
  7819.           Read permission allows a user to read the contents of the file,  or
  7820.      in the case of directories, to list the contents of the directory (using
  7821.      ls). Write permission allows the user to write to and modify  the  file.
  7822.      For directories, write permission allows the user to create new files or
  7823.      delete files within that directory. Finally, execute  permission  allows
  7824.      the  user to run the file as a program or shell script (if the file hap¡
  7825.      pens to be a program or shell script, that is).  For directories, having
  7826.      execute permission allows the user to cd into the directory in question.
  7827.  
  7828.  
  7829.      4.9.2  Interpreting file permissions
  7830.  
  7831.      Let's look at an example to demonstrate file permissions. Using  the  ls
  7832.      command  with the -l option will display a ``long'' listing of the file,
  7833.      including file permissions.
  7834.  
  7835.  
  7836.           /home/larry/foo#/home/larry/foo# ls -l stuff
  7837.  
  7838.           -rw-r--r--   1 larry    users         505 Mar 13 19:05 stuff
  7839.           /home/larry/foo#
  7840.  
  7841.  
  7842.  
  7843.           The first field printed in the listing represents the file  permis¡
  7844.      sions.  The third field is the owner of the file (larry), and the fourth
  7845.      field is the group to which the file  belongs  (users).  Obviously,  the
  7846.  
  7847.  
  7848.                                 - 121 -
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858.      last  field  is  the name of the file (stuff), and we'll cover the other
  7859.      fields later.
  7860.  
  7861.  
  7862.           This file is owned by larry, and belongs to the group users.  Let's
  7863.      look at the file permissions. The string -rw-r--r-- lists, in order, the
  7864.      permissions granted to the file's owner, the file's group, and everybody
  7865.      else.
  7866.  
  7867.  
  7868.           The  first  character  of the permissions string (``-'') represents
  7869.      the type of file. A ``-'' just means that this is  a  regular  file  (as
  7870.      opposed  to  a  directory  or  device  driver).  The  next three letters
  7871.      (``rw-'') represent the permissions granted to the file's owner,  larry.
  7872.      The  ``r'' stands for ``read'' and the ``w'' stands for ``write''. Thus,
  7873.      larry has read and write permission to the file stuff.
  7874.  
  7875.  
  7876.           As we mentioned, besides read and write permission, there  is  also
  7877.      ``execute''  permission---represented  by  an ``x''. However, there is a
  7878.      ``-'' here in place of the ``x'', so Larry doesn't have execute  permis¡
  7879.      sion  on  this file. This is fine, the file stuff isn't a program of any
  7880.      kind. Of course, because Larry owns the file, he may grant himself  exe¡
  7881.      cute  permission  for  the  file if he so desires.  This will be covered
  7882.      shortly.
  7883.  
  7884.  
  7885.           The next three characters, r--, represent the  group's  permissions
  7886.      on  the  file.  The group which owns this file is users. Because only an
  7887.      ``r'' appears here, any user which belongs to the group users  may  read
  7888.      this file.
  7889.  
  7890.  
  7891.           The  last  three  characters,  also  r--, represent the permissions
  7892.      granted to every other user on the system (other than the owner  of  the
  7893.      file and those in the group users). Again, because only an ``r'' is pre¡
  7894.      sent, other users may read the file, but not write to it or execute  it.
  7895.  
  7896.  
  7897.           Here are some other examples of group permissions.
  7898.  
  7899.  
  7900.              * -rwxr-xr-x  The owner of the file may read, write, and execute
  7901.                the file. Users in the file's group, and all other users,  may
  7902.                read and execute the file.
  7903.  
  7904.  
  7905.              * -rw-------  The owner of the file may read and write the file.
  7906.                No other user can access the file.
  7907.  
  7908.  
  7909.              * -rwxrwxrwx All users may read, write, and execute the file.
  7910.  
  7911.  
  7912.  
  7913.  
  7914.                                 - 122 -
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.      4.9.3  Dependencies
  7925.  
  7926.      It is important to note that the permissions  granted  to  a  file  also
  7927.      depend on the permissions of the directory in which the file is located.
  7928.      For example, even if a file is set to  -rwxrwxrwx,  other  users  cannot
  7929.      access  the  file unless they have read and execute access to the direc¡
  7930.      tory in which the file is located.  For  example,  if  Larry  wanted  to
  7931.      restrict access to all of his files, he could simply set the permissions
  7932.      on his home directory /home/larry to -rwx------. In this way,  no  other
  7933.      user  has  access to his directory, and all files and directories within
  7934.      it. Larry doesn't need to worry about the individual permissions on each
  7935.      of his files.
  7936.  
  7937.  
  7938.           In  other  words,  to  access  a file at all, you must have execute
  7939.      access to all directories along the file's pathname, and read access  to
  7940.      the file itself.
  7941.  
  7942.  
  7943.           Usually,  users  on  a  UNIX system are very open with their files.
  7944.      The usual set of permissions given to files is  -rw-r--r--,  which  will
  7945.      allow  other  users to read the file, but not change it in any way.  The
  7946.      usual set of permissions given to directories is -rwxr-xr-x, which  will
  7947.      allow  other  users  to look through your directories, but not create or
  7948.      delete files within them.
  7949.  
  7950.  
  7951.           However, many users wish to keep other users out  of  their  files.
  7952.      Setting the permissions of a file to -rw------- will not allow any other
  7953.      user to access the file. Likewise, setting the permissions of  a  direc¡
  7954.      tory  to  -rwx------ will keep other users out of the directory in ques¡
  7955.      tion.
  7956.  
  7957.  
  7958.      4.9.4  Changing permissions
  7959.  
  7960.      The command chmod is used to set the permissions on  a  file.  Only  the
  7961.      owner  of a file may change the permissions on that file.  The syntax of
  7962.      chmod is:
  7963.  
  7964.  
  7965.           chmod {a,u,g,o}{+,-}{r,w,x} <filenames>
  7966.  
  7967.  
  7968.  
  7969.  
  7970.           Briefly, you supply one or more of all, user, group, or other. Then
  7971.      you  specify  whether you are adding rights (+) or taking them away (-).
  7972.      Finally, you specify one or more of read, write, and execute. Some exam¡
  7973.      ples of legal commands are:
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.                                 - 123 -
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990.              * chmod a+r stuff Gives all users read access to the file.
  7991.  
  7992.              * chmod  +r  stuff  Same  as above---if none of a, u, g, or o is
  7993.                specified, a is assumed.
  7994.  
  7995.              * chmod og-x stuff Remove execute permission  from  users  other
  7996.                than the owner.
  7997.  
  7998.              * chmod  u+rwx stuff Allow the owner of the file to read, write,
  7999.                and execute the file.
  8000.  
  8001.              * chmod o-rwx stuff Remove read, write, and  execute  permission
  8002.                from users other than the owner and users in the file's group.
  8003.  
  8004.  
  8005.  
  8006.      4.10  Job Control
  8007.  
  8008.      4.10.1  Jobs and processes
  8009.  
  8010.      Job control is  a  feature  provided  by  many  shells  (Bash  and  Tcsh
  8011.      included)  which  allows  you  to  control multiple running commands, or
  8012.      jobs, at once. Before we can delve much further, we need to  talk  about
  8013.      processes.
  8014.  
  8015.  
  8016.           Every  time  you  run  a program, you start what is known as a pro¡
  8017.      cess---which is just a fancy name for a running program.  The command ps
  8018.      displays a list of currently running processes. Here's an example:
  8019.  
  8020.  
  8021.           /home/larry# ps
  8022.  
  8023.             PID TT STAT  TIME COMMAND
  8024.              24  3 S     0:03 (bash)
  8025.             161  3 R     0:00 ps
  8026.           /home/larry#
  8027.  
  8028.           The PID listed in the first column is the process ID, a unique num¡
  8029.      ber given to every running process. The last  column,  COMMAND,  is  the
  8030.      name  of  the running command. Here, we're only looking at the processes
  8031.      which  Larry  is  currently running(2) . These are bash (Larry's shell),
  8032.      and the ps command itself. As you can see, bash is running  concurrently
  8033.      with  the  ps  command.   bash executed ps when Larry typed the command.
  8034.      After ps is finished running (after  the  table  of  processes  is  dis¡
  8035.      played),  control  is  returned  to the bash process, which displays the
  8036.      prompt, ready for another command.
  8037.  
  8038.  
  8039.           A running process is known as a job to the shell. The terms process
  8040.      and  job  are interchangeable. However, a process is usually referred to
  8041.  
  8042.      
  8043.  
  8044.      2. There are many other processes running on the  system  as
  8045.         well---``ps -aux'' lists them all.
  8046.  
  8047.                                 - 124 -
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.      as a ``job'' when used in conjunction with job  control---a  feature  of
  8058.      the shell which allows you to switch between several independent jobs.
  8059.  
  8060.  
  8061.           In  most cases users are only running a single job at a time---that
  8062.      being whatever command they last typed to the shell. However, using  job
  8063.      control,  you  can  run  several jobs at once, switching between them as
  8064.      needed. How might this be useful? Let's say that you're editing  a  text
  8065.      file  and need to suddenly interrupt your editing and do something else.
  8066.      With job control, you can temporarily suspend the editor,  and  back  at
  8067.      the  shell prompt start to work on something else. When you're done, you
  8068.      can start the editor back up, and be back where you started, as  if  you
  8069.      never  left the editor. This is just one example. There are many practi¡
  8070.      cal uses for job control.
  8071.  
  8072.  
  8073.      4.10.2  Foreground and background
  8074.  
  8075.      Jobs can either be in the foreground or in the  background.   There  can
  8076.      only be one job in the foreground at any one time. The foreground job is
  8077.      the job which you interact with---it receives input  from  the  keyboard
  8078.      and sends output to your screen. (Unless, of course, you have redirected
  8079.      input or output, as described in Section 4.8). On the other  hand,  jobs
  8080.      in  the  background do not receive input from the terminal---in general,
  8081.      they run along quietly without need for interaction.
  8082.  
  8083.  
  8084.           Some jobs take a long time to finish, and don't do anything  inter¡
  8085.      esting  while  they are running.  Compiling programs is one such job, as
  8086.      is compressing a large file.  There's  no  reason  why  you  should  sit
  8087.      around  being  bored while these jobs complete their tasks; you can just
  8088.      run them in the background. While the jobs  are  running  in  the  back¡
  8089.      ground, you are free to run other programs.
  8090.  
  8091.  
  8092.           Jobs  may  also  be suspended. A suspended job is a job that is not
  8093.      currently running, but is temporarily stopped. After you suspend a  job,
  8094.      you can tell the job to continue, in the foreground or the background as
  8095.      needed. Resuming a suspended job will not change the state of the job in
  8096.      any way---the job will continue to run where it left off.
  8097.  
  8098.  
  8099.           Note that suspending a job is not equal to interrupting a job. When
  8100.      you interrupt a running process (by hitting your interrupt key, which is
  8101.      usually  `ctrl-C')(3) , it kills the process, for good.  Once the job is
  8102.      killed, there's no hope of resuming it; you'll have to re-run  the  com¡
  8103.      mand.  Also  note that some programs trap the interrupt, so that hitting
  8104.      `ctrl-C' won't immediately kill the job. This is to allow the program to
  8105.      perform  any necessary cleanup operations before exiting.  In fact, some
  8106.      programs simply don't allow you to kill them with an interrupt at all.
  8107.  
  8108.      
  8109.  
  8110.      3. The  interrupt key can be set using the stty command. The
  8111.         default  on  most  systems  is  `ctrl-C',  but  we  can't
  8112.         guarantee the same for your system.
  8113.  
  8114.                                 - 125 -
  8115.  
  8116.  
  8117.  
  8118.  
  8119.  
  8120.  
  8121.  
  8122.  
  8123.  
  8124.      4.10.3  Backgrounding and killing jobs
  8125.  
  8126.      Let's begin with a simple example. The command yes is a  seemingly  use¡
  8127.      less  command  which  sends an endless stream of y's to standard output.
  8128.      (This is actually useful. If you piped the output of yes to another com¡
  8129.      mand  which  asked  a  series of yes and no questions, the stream of y's
  8130.      would confirm all of the questions.)
  8131.  
  8132.  
  8133.           Try it out.
  8134.  
  8135.  
  8136.           /home/larry# yes
  8137.           y
  8138.           y
  8139.           y
  8140.           y
  8141.           y
  8142.  
  8143.  
  8144.           The y's will continue ad infinitum. You can  kill  the  process  by
  8145.      hitting your interrupt key, which is usually `ctrl-C'.  So that we don't
  8146.      have to put up with the annoying stream of y's, let's redirect the stan¡
  8147.      dard  output of yes to /dev/null. As you may remember, /dev/null acts as
  8148.      a ``black hole'' for data.  Any data sent to it will disappear. This  is
  8149.      a very effective method of quieting an otherwise verbose program.
  8150.  
  8151.  
  8152.           /home/larry# yes > /dev/null
  8153.  
  8154.  
  8155.           Ah,  much  better. Nothing is printed, but the shell prompt doesn't
  8156.      come back. This is because yes is still running, and  is  sending  those
  8157.      inane y's to /dev/null. Again, to kill the job, hit the interrupt key.
  8158.  
  8159.  
  8160.           Let's  suppose  that  we wanted the yes command to continue to run,
  8161.      but wanted to get our shell prompt back to work on other things.  We can
  8162.      put  yes  into  the  background, which will allow it to run, but without
  8163.      need for interaction.
  8164.  
  8165.  
  8166.           One way to put a process in the background is to  append  an  ``&''
  8167.      character to the end of the command.
  8168.  
  8169.  
  8170.           /home/larry# yes > /dev/null &
  8171.           [1] 164
  8172.           /home/larry#
  8173.  
  8174.           As  you  can  see,  we have our shell prompt back. But what is this
  8175.      ``[1] 164''? And is the yes command really running?
  8176.  
  8177.  
  8178.  
  8179.  
  8180.                                 - 126 -
  8181.  
  8182.  
  8183.  
  8184.  
  8185.  
  8186.  
  8187.  
  8188.  
  8189.  
  8190.           The ``[1]'' represents the job number  for  the  yes  process.  The
  8191.      shell  assigns a job number to every running job. Because yes is the one
  8192.      and only job that we're currently running, it is assigned job number  1.
  8193.      The ``164'' is the process ID, or PID, number given by the system to the
  8194.      job. Either number may be used to refer to the job, as we'll see  later.
  8195.  
  8196.  
  8197.           You  now  have  the yes process running in the background, continu¡
  8198.      ously sending a stream of y's to /dev/null. To check on  the  status  of
  8199.      this process, use the shell internal command jobs.
  8200.  
  8201.  
  8202.           /home/larry# jobs
  8203.           [1]+  Running                 yes >/dev/null  &
  8204.           /home/larry#
  8205.  
  8206.           Sure  enough,  there  it  is.  You could also use the ps command as
  8207.      demonstrated above to check on the status of the job.
  8208.  
  8209.  
  8210.           To terminate the job, use the command  kill.   This  command  takes
  8211.      either  a job number or a process ID number as an argument. This was job
  8212.      number 1, so using the command
  8213.  
  8214.  
  8215.           /home/larry# kill %1
  8216.  
  8217.  
  8218.           will kill the job. When identifying the job with  the  job  number,
  8219.      you must prefix the number with a percent (``%'') character.
  8220.  
  8221.  
  8222.           Now  that  we've  killed the job, we can use jobs again to check on
  8223.      it:
  8224.  
  8225.  
  8226.           /home/larry# jobs
  8227.  
  8228.           [1]+  Terminated              yes >/dev/null
  8229.           /home/larry#
  8230.  
  8231.           The job is in fact dead, and if we use the jobs command again noth¡
  8232.      ing should be printed.
  8233.  
  8234.  
  8235.           You  can also kill the job using the process ID (PID) number, which
  8236.      is printed along with the job ID when you start the job. In our example,
  8237.      the process ID is 164, so the command
  8238.  
  8239.  
  8240.           /home/larry# kill 164
  8241.  
  8242.  
  8243.           is equivalent to
  8244.  
  8245.  
  8246.                                 - 127 -
  8247.  
  8248.  
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.           /home/larry# kill %1
  8257.  
  8258.  
  8259.           You don't need to use the ``%'' when referring to a job by its pro¡
  8260.      cess ID.
  8261.  
  8262.  
  8263.      4.10.4  Stopping and restarting jobs
  8264.  
  8265.      There is another way to put a job into the background. You can start the
  8266.      job  normally  (in the foreground), stop the job, and then restart it in
  8267.      the background. We'll demonstrate this below.
  8268.  
  8269.  
  8270.           First, start the yes process in the  foreground,  as  you  normally
  8271.      would:
  8272.  
  8273.  
  8274.           /home/larry# yes > /dev/null
  8275.  
  8276.  
  8277.           Again,  because yes is running in the foreground, you shouldn't get
  8278.      your shell prompt back.
  8279.  
  8280.  
  8281.           Now, instead of interrupting the job with `ctrl-C',  we'll  suspend
  8282.      the job. Suspending a job doesn't kill it: it only temporarily stops the
  8283.      job until you restart it. To do this, you hit the suspend key, which  is
  8284.      usually `ctrl-Z'.
  8285.  
  8286.  
  8287.           /home/larry# yes > /dev/null
  8288.           `ctrl-Z'
  8289.           [1]+  Stopped                 yes >/dev/null
  8290.           /home/larry#
  8291.  
  8292.           While the job is suspended, it's simply not running. No CPU time is
  8293.      used for the job. However, you can restart the job, which will cause the
  8294.      job  to  run  again as if nothing ever happened. It will continue to run
  8295.      where it left off.
  8296.  
  8297.  
  8298.           To restart the job in the  foreground,  use  the  command  fg  (for
  8299.      ``foreground'').
  8300.  
  8301.  
  8302.           /home/larry# fg
  8303.           yes >/dev/null
  8304.  
  8305.  
  8306.           The  shell  prints the name of the command again so you're aware of
  8307.      which job you just put into the foreground. Stop  the  job  again,  with
  8308.      `ctrl-Z'.   This  time, use the command bg to put the job into the back¡
  8309.      ground.  This will cause the command to run just as if you  started  the
  8310.  
  8311.  
  8312.                                 - 128 -
  8313.  
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.      command with ``&'' as in the last section.
  8323.  
  8324.  
  8325.           /home/larry# bg
  8326.           [1]+ yes >/dev/null  &
  8327.           /home/larry#
  8328.  
  8329.           And  we have our prompt back. jobs should report that yes is indeed
  8330.      running, and we can kill the job with kill as we did before.
  8331.  
  8332.  
  8333.           How can we stop the job again? Using `ctrl-Z' won't  work,  because
  8334.      the  job is in the background. The answer is to put the job in the fore¡
  8335.      ground, with fg, and then stop it. As it turns out you  can  use  fg  on
  8336.      either stopped jobs or jobs in the background.
  8337.  
  8338.  
  8339.           There is a big difference between a job in the background and a job
  8340.      which is stopped. A stopped job is not running---it's not using any  CPU
  8341.      time, and it's not doing any work (the job still occupies system memory,
  8342.      although it may be swapped out to disk). A job in the background is run¡
  8343.      ning,  and  using  memory,  as well as completing some task while you do
  8344.      other work. However, a job in the background may try to display text  on
  8345.      to  your  terminal,  which  can  be annoying if you're trying to work on
  8346.      something else. For example, if you used the command
  8347.  
  8348.  
  8349.           /home/larry# yes &
  8350.  
  8351.  
  8352.           without redirecting stdout to /dev/null, a stream of y's  would  be
  8353.      printed  to  your  screen, without any way of interrupting it (you can't
  8354.      use `ctrl-C' to interrupt jobs in the background).  In order to stop the
  8355.      endless  y's,  you'd have to use the kill command (without being able to
  8356.      see what you're typing).
  8357.  
  8358.  
  8359.           Another note. The fg and bg commands normally foreground  or  back¡
  8360.      ground  the job which was last stopped (indicated by a ``+'' next to the
  8361.      job number when you use the command jobs).  If you are running  multiple
  8362.      jobs  at once, you can foreground or background a specific job by giving
  8363.      the job ID as an argument to fg or bg, as in
  8364.  
  8365.  
  8366.           /home/larry# fg %2
  8367.  
  8368.  
  8369.           (to foreground job number 2), or
  8370.  
  8371.  
  8372.           /home/larry# bg %3
  8373.  
  8374.  
  8375.           (to background job number 3). You can't use process ID numbers with
  8376.  
  8377.  
  8378.                                 - 129 -
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.      fg or bg.
  8389.  
  8390.  
  8391.           Furthermore, using the job number alone, as in
  8392.  
  8393.  
  8394.           /home/larry# %2
  8395.  
  8396.  
  8397.           is equivalent to
  8398.  
  8399.  
  8400.           /home/larry# fg %2
  8401.  
  8402.  
  8403.  
  8404.  
  8405.           Just remember that using job control is a feature of the shell. The
  8406.      commands fg, bg and jobs are internal to the shell.  If for some  reason
  8407.      you use a shell which does not support job control, don't expect to find
  8408.      these commands available.
  8409.  
  8410.  
  8411.           In addition, there are some aspects of  job  control  which  differ
  8412.      between Bash and Tcsh. In fact, some shells don't provide job control at
  8413.      all---however, most shells available for Linux support job control.
  8414.  
  8415.  
  8416.      4.11  Using the vi Editor
  8417.  
  8418.      A text editor is simply a program used to edit files which contain text,
  8419.      such  as  a  letter,  C  program, or a system configuration file.  While
  8420.      there are many such editors available for Linux, the only  editor  which
  8421.      you are guaranteed to find on any UNIX system is vi--- the ``visual edi¡
  8422.      tor''. vi is not the easiest  editor  to  use,  nor  is  it  very  self-
  8423.      explanatory.  However, because it is so common in the UNIX world, and at
  8424.      times you may be required to use  it,  it  deserves  some  documentation
  8425.      here.
  8426.  
  8427.  
  8428.           The editor which you prefer to use is mostly a question of personal
  8429.      taste and style. Many users prefer  the  baroque,  self-explanatory  and
  8430.      powerful Emacs---an editor with more features than any single program in
  8431.      the UNIX world. For example, Emacs has its own built-in dialect  of  the
  8432.      LISP  programming  language, and has many extensions (one of which is an
  8433.      ``Eliza''-like AI program). However, because Emacs and all of  its  sup¡
  8434.      port  files  are relatively large, you may not have access to it on many
  8435.      systems.  vi, on the other hand, is small and powerful, but more  diffi¡
  8436.      cult  to  use.  However, once you know your way around vi, it's actually
  8437.      very easy. It's just the learning curve which is sometimes difficult  to
  8438.      cross.
  8439.  
  8440.  
  8441.           This  section  is  a coherent introduction to vi---we won't discuss
  8442.  
  8443.  
  8444.                                 - 130 -
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.      all of its features, just the ones you need to know to get you  started.
  8455.      You  can  refer  to the man page for vi if you're interested in learning
  8456.      about more of this editor's features. Or, you can read the book Learning
  8457.      the  vi Editor from O'Reilly and Associates. See Appendix A for infor¡
  8458.      mation.
  8459.  
  8460.  
  8461.      4.11.1  Concepts
  8462.  
  8463.      While using vi, at any one time you are in one of three modes of  opera¡
  8464.      tion.  These  modes  are known as command mode, edit mode, and last line
  8465.      mode.
  8466.  
  8467.  
  8468.           When you start up vi, you are in command mode. This mode allows you
  8469.      to  use  certain commands to edit files or to change to other modes. For
  8470.      example, typing ``x'' while in command mode deletes the character under¡
  8471.      neath  the  cursor. The arrow keys move the cursor around the file which
  8472.      you're editing. Generally, the commands used in command mode are one  or
  8473.      two characters long.
  8474.  
  8475.  
  8476.           You  actually  insert or edit text within edit mode. When using vi,
  8477.      you'll probably spend most of your time within  this  mode.   You  start
  8478.      edit mode by using a command such as ``i'' (for ``insert'') from command
  8479.      mode. While in edit mode, you are inserting text into the document  from
  8480.      your  current  cursor  location.  To end edit mode and return to command
  8481.      mode, press `esc'.
  8482.  
  8483.  
  8484.           Last line mode is a special mode used to give certain extended com¡
  8485.      mands  to  vi. While typing these commands, they appear on the last line
  8486.      of the screen (hence the name). For example, when you  type  ``:''  from
  8487.      command mode, you jump into last line mode, and can use commands such as
  8488.      ``wq'' (to write the file and quit vi), or ``q!'' (to  quit  vi  without
  8489.      saving  changes). Last line mode is generally used for vi commands which
  8490.      are longer than one character.
  8491.  
  8492.  
  8493.      4.11.2  Starting vi
  8494.  
  8495.      The best way to understand these concepts is to actually fire up vi  and
  8496.      edit  a file. In the example ``screens'' below, we're only going to show
  8497.      a few lines of text, as if the screen was only six lines  high  (instead
  8498.      of twenty-five).
  8499.  
  8500.  
  8501.           The syntax for vi is
  8502.  
  8503.  
  8504.           vi <filename>
  8505.  
  8506.  
  8507.           where <filename> is the name of the file that you wish to edit.
  8508.  
  8509.  
  8510.                                 - 131 -
  8511.  
  8512.  
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.  
  8520.           Start up vi by typing
  8521.  
  8522.  
  8523.           /home/larry# vi test
  8524.  
  8525.  
  8526.           which will edit the file test.  You should see something like
  8527.  
  8528.  
  8529.  
  8530.           ~
  8531.           ~
  8532.           ~
  8533.           ~
  8534.           ~
  8535.           ~
  8536.           "test" [New file]
  8537.  
  8538.  
  8539.  
  8540.  
  8541.           The  column  of  ``~'' characters indicates that you are the end of
  8542.      the file.
  8543.  
  8544.  
  8545.      4.11.3  Inserting text
  8546.  
  8547.      You are now in command mode; in order to  insert  text  into  the  file,
  8548.      press `i' (which will place you into edit mode), and begin typing.
  8549.  
  8550.  
  8551.  
  8552.           Now  is  the  time for all good men to come to the aid of the party.
  8553.           ~
  8554.           ~
  8555.           ~
  8556.           ~
  8557.           ~
  8558.  
  8559.  
  8560.  
  8561.  
  8562.           While inserting text, you may  type  as  many  lines  as  you  wish
  8563.      (pressing  `return' after each, of course), and you may correct mistakes
  8564.      using the backspace key.
  8565.  
  8566.  
  8567.           To end edit mode, and return to command mode, press `esc'.
  8568.  
  8569.  
  8570.           While in command mode, you can use the arrow keys  to  move  around
  8571.      the file. Here, because we only have one line of text, trying to use the
  8572.      up- or down-arrow keys will probably cause vi to beep at you.
  8573.  
  8574.  
  8575.                                 - 132 -
  8576.  
  8577.  
  8578.  
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.           There are several ways to insert text, other than using the i  com¡
  8586.      mand.  For  example, the a command inserts text beginning after the cur¡
  8587.      rent cursor position, instead of on the  current  cursor  position.  For
  8588.      example,  use  the  left  arrow key to move the cursor between the words
  8589.      ``good'' and ``men''.
  8590.  
  8591.  
  8592.  
  8593.           Now is the time for all good men to come to  the  aid  of the party.
  8594.           ~
  8595.           ~
  8596.           ~
  8597.           ~
  8598.           ~
  8599.  
  8600.  
  8601.           Press  `a',  to start edit mode, type ``wo'', and then hit `esc' to
  8602.      return to command mode.
  8603.  
  8604.  
  8605.  
  8606.           Now is the time for all good women to come to the aid  of the party.
  8607.           ~
  8608.           ~
  8609.           ~
  8610.           ~
  8611.           ~
  8612.  
  8613.  
  8614.  
  8615.  
  8616.           To  begin inserting text at the line below the current one, use the
  8617.      o command. For example, press `o' and type another line or two:
  8618.  
  8619.  
  8620.  
  8621.           Now is the time for all good women to come to the aid  of the party.
  8622.           Afterwards, we'll go out for pizza and beer.
  8623.           ~
  8624.           ~
  8625.           ~
  8626.           ~
  8627.  
  8628.  
  8629.  
  8630.  
  8631.           Just remember that at any time you're either in command mode (where
  8632.      commands such as i, a, or o are valid), or in edit  mode  (where  you're
  8633.      inserting text, followed by `esc' to return to command mode).
  8634.  
  8635.  
  8636.  
  8637.  
  8638.                                 - 133 -
  8639.  
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.  
  8646.  
  8647.  
  8648.      4.11.4  Deleting text
  8649.  
  8650.      From command mode, the x command deletes the character under the cursor.
  8651.      If you press `x' five times, you'll end up with:
  8652.  
  8653.  
  8654.  
  8655.           Now is the time for all good women to come to the aid  of the party.
  8656.           Afterwards, we'll go out for pizza and
  8657.           ~
  8658.           ~
  8659.           ~
  8660.           ~
  8661.  
  8662.  
  8663.           Now press `a', insert some text, followed by `esc':
  8664.  
  8665.  
  8666.  
  8667.           Now  is the time for all good women to come to the aid of the party.
  8668.           Afterwards, we'll go out for pizza and Diet Coke.
  8669.           ~
  8670.           ~
  8671.           ~
  8672.           ~
  8673.  
  8674.  
  8675.  
  8676.  
  8677.           You can delete entire lines using the command dd  (that  is,  press
  8678.      `d'  twice in a row). If your cursor is on the second line, and you type
  8679.      dd,
  8680.  
  8681.  
  8682.  
  8683.           Now is the time for all good women to come to the aid  of the party.
  8684.           ~
  8685.           ~
  8686.           ~
  8687.           ~
  8688.           ~
  8689.  
  8690.  
  8691.  
  8692.  
  8693.           To  delete  the  word  which  the cursor is on, use the dw command.
  8694.      Place the cursor on the word ``good'', and type dw.
  8695.  
  8696.  
  8697.  
  8698.  
  8699.  
  8700.  
  8701.                                 - 134 -
  8702.  
  8703.  
  8704.  
  8705.  
  8706.  
  8707.  
  8708.  
  8709.  
  8710.  
  8711.           Now is the time for all women to come to the aid  of  the party.
  8712.           ~
  8713.           ~
  8714.           ~
  8715.           ~
  8716.           ~
  8717.  
  8718.  
  8719.  
  8720.  
  8721.      4.11.5  Changing text
  8722.  
  8723.      You  can  replace sections of text using the R command. Place the cursor
  8724.      on the first letter in ``party'', press `R', and type  the  word  ``hun¡
  8725.      gry''.
  8726.  
  8727.  
  8728.  
  8729.           Now  is  the time for all women to come to the aid of the hungry.
  8730.           ~
  8731.           ~
  8732.           ~
  8733.           ~
  8734.           ~
  8735.  
  8736.  
  8737.           Using R to edit text is much like the i and a commands, but R over¡
  8738.      writes text, instead of inserting it.
  8739.  
  8740.  
  8741.           The  r command replaces the single character under the cursor.  For
  8742.      example, move the cursor to the beginning of the word ``Now'', and  type
  8743.      r followed by C, you'll have:
  8744.  
  8745.  
  8746.  
  8747.           Cow  is  the time for all women to come to the aid of the hungry.
  8748.           ~
  8749.           ~
  8750.           ~
  8751.           ~
  8752.           ~
  8753.  
  8754.  
  8755.  
  8756.  
  8757.           The ``~'' command changes the case of the letter under  the  cursor
  8758.      from upper- to lower-case, and vise versa, For example, if you place the
  8759.      cursor on the ``o'' in ``Cow'', above, and repeatedly press `~',  you'll
  8760.      end up with:
  8761.  
  8762.  
  8763.  
  8764.                                 - 135 -
  8765.  
  8766.  
  8767.  
  8768.  
  8769.  
  8770.  
  8771.  
  8772.  
  8773.  
  8774.           COW  IS  THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.
  8775.           ~
  8776.           ~
  8777.           ~
  8778.           ~
  8779.           ~
  8780.  
  8781.  
  8782.  
  8783.  
  8784.      4.11.6  Moving commands
  8785.  
  8786.      You already know how to use the arrow keys to move around the  document.
  8787.      In  addition, you can use the h, j, k, and l commands to move the cursor
  8788.      left, down, up, and right, respectively.  This comes in handy when  (for
  8789.      some reason) your arrow keys aren't working correctly.
  8790.  
  8791.  
  8792.           The  w  command moves the cursor to the beginning of the next word;
  8793.      the b moves it to the beginning of the previous word.
  8794.  
  8795.  
  8796.           The 0 (that's a zero) command moves the cursor to the beginning  of
  8797.      the current line, and the $ command moves it to the end of the line.
  8798.  
  8799.  
  8800.           When editing large files, you'll want to move forwards or backwards
  8801.      through the file a screenful at a time. Pressing `ctrl-F' moves the cur¡
  8802.      sor one screenful forward, and `ctrl-B' moves it a screenful back.
  8803.  
  8804.  
  8805.           In order to move the cursor to the end of the file, type G. You can
  8806.      also move to an arbitrary line; for  example,  typing  the  command  10G
  8807.      would  move  the cursor to line 10 in the file. To move to the beginning
  8808.      of the file, use 1G.
  8809.  
  8810.  
  8811.           You can couple moving commands with other commands, such  as  dele¡
  8812.      tion.   For example, the command d$ will delete everything from the cur¡
  8813.      sor to the end of the line; dG will delete everything from the cursor to
  8814.      the end of the file, and so on.
  8815.  
  8816.  
  8817.      4.11.7  Saving files and quitting vi
  8818.  
  8819.      To quit vi without making changes to the file, use the command :q!. When
  8820.      you type the ``:'', the cursor will move to the last line on the screen;
  8821.      you'll be in last line mode.
  8822.  
  8823.  
  8824.  
  8825.  
  8826.  
  8827.  
  8828.  
  8829.                                 - 136 -
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.           COW  IS  THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.
  8840.           ~
  8841.           ~
  8842.           ~
  8843.           ~
  8844.           ~
  8845.           :
  8846.  
  8847.  
  8848.           In last line mode, certain extended commands are available. One  of
  8849.      them  is  q!,  which  quits vi without saving. The command :wq saves the
  8850.      file and then exits vi. The command ZZ (from command mode,  without  the
  8851.      ``:'') is equivalent to :wq.
  8852.  
  8853.  
  8854.           To save the file without quitting vi, just use :w.
  8855.  
  8856.  
  8857.      4.11.8  Editing another file
  8858.  
  8859.      To  edit  another file, use the :e command. For example, to stop editing
  8860.      test, and edit the file foo instead, use the command
  8861.  
  8862.  
  8863.  
  8864.           COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID  OF  THE HUNGRY.
  8865.           ~
  8866.           ~
  8867.           ~
  8868.           ~
  8869.           ~
  8870.           :e foo
  8871.  
  8872.  
  8873.           If  you  use :e without saving the file first, you'll get the error
  8874.      message
  8875.  
  8876.  
  8877.  
  8878.           No write since last change (":edit!" overrides)
  8879.  
  8880.  
  8881.           which simply means that vi doesn't want to edit another file  until
  8882.      you save the first one. At this point, you can use :w to save the origi¡
  8883.      nal file, and then use :e, or you can use the command
  8884.  
  8885.  
  8886.  
  8887.  
  8888.  
  8889.  
  8890.  
  8891.  
  8892.  
  8893.                                 - 137 -
  8894.  
  8895.  
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.  
  8902.  
  8903.           COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID  OF  THE HUNGRY.
  8904.           ~
  8905.           ~
  8906.           ~
  8907.           ~
  8908.           ~
  8909.           :e! foo
  8910.  
  8911.  
  8912.           The  ``!''  tells  vi  that  you really mean it---edit the new file
  8913.      without saving changes to the first.
  8914.  
  8915.  
  8916.      4.11.9  Including other files
  8917.  
  8918.      If you use the :r command, you can include the contents of another  file
  8919.      in the current file. For example, the command
  8920.  
  8921.  
  8922.           :r foo.txt
  8923.  
  8924.  
  8925.           would  insert  the  contents of the file foo.txt in the text at the
  8926.      current cursor location.
  8927.  
  8928.  
  8929.      4.11.10  Running shell commands
  8930.  
  8931.      You can also run shell commands from within vi. The  :r!  command  works
  8932.      like  :r,  but  instead  of reading a file, it inserts the output of the
  8933.      given command into the buffer at the current cursor location.  For exam¡
  8934.      ple, if you use the command
  8935.  
  8936.  
  8937.           :r! ls -F
  8938.  
  8939.  
  8940.           you'll end up with
  8941.  
  8942.  
  8943.  
  8944.           COW  IS  THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.
  8945.           letters/
  8946.           misc/
  8947.           papers/
  8948.           ~
  8949.           ~
  8950.  
  8951.  
  8952.  
  8953.  
  8954.           You can also ``shell out'' of vi, in other  words,  run  a  command
  8955.  
  8956.  
  8957.                                 - 138 -
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.      from  within vi, and return to the editor when you're done. For example,
  8968.      if you use the command
  8969.  
  8970.  
  8971.           :! ls -F
  8972.  
  8973.  
  8974.           the ls -F command will be executed, and the  results  displayed  on
  8975.      the screen, but not inserted into the file which you're editing.  If you
  8976.      use the command
  8977.  
  8978.  
  8979.           :shell
  8980.  
  8981.  
  8982.           vi will start an instance of the shell, allowing you to temporarily
  8983.      put  vi ``on hold'' while you execute other commands. Just logout of the
  8984.      shell (using the exit command) to return to vi.
  8985.  
  8986.  
  8987.      4.11.11  Getting help
  8988.  
  8989.      vi doesn't provide much in the way of interactive help (most  UNIX  pro¡
  8990.      grams  don't),  but  you  can  always read the man page for vi.  vi is a
  8991.      visual front-end to the ex editor; it is ex which handles  many  of  the
  8992.      last-line  mode  commands in vi. So, in addition to reading the man page
  8993.      for vi, see ex as well.
  8994.  
  8995.  
  8996.      4.12  Customizing your Environment
  8997.  
  8998.      The shell provides many mechanisms to customize your  work  environment.
  8999.      As  we've  mentioned  before,  the  shell  is more than a command inter¡
  9000.      preter---it is also a powerful programming language. While writing shell
  9001.      scripts  is  an extensive subject, we'd like to introduce you to some of
  9002.      the ways that you can simplify your work on a UNIX system by using these
  9003.      advanced features of the shell.
  9004.  
  9005.  
  9006.           As  we  have  mentioned before, different shells use different syn¡
  9007.      taxes when executing shell scripts. For example, Tcsh uses a C-like syn¡
  9008.      tax, while Bourne shells use another type of syntax. In this section, we
  9009.      won't be running into many of the differences between the  two,  but  we
  9010.      will  assume that shell scripts are executed using the Bourne shell syn¡
  9011.      tax.
  9012.  
  9013.  
  9014.      4.12.1  Shell scripts
  9015.  
  9016.      Let's say that you use a series of commands often,  and  would  like  to
  9017.      shorten  the  amount of required typing by grouping all of them together
  9018.      into a single ``command''. For example, the commands
  9019.  
  9020.  
  9021.  
  9022.  
  9023.                                 - 139 -
  9024.  
  9025.  
  9026.  
  9027.  
  9028.  
  9029.  
  9030.  
  9031.  
  9032.  
  9033.           /home/larry# cat chapter1 chapter2 chapter3 > book
  9034.           /home/larry# wc -l book
  9035.           /home/larry# lp book
  9036.  
  9037.  
  9038.           would concatenate the files chapter1, chapter2,  and  chapter3  and
  9039.      place  the result in the file book. Then, a count of the number of lines
  9040.      in book would be displayed, and finally book would be printed  with  the
  9041.      lp command.
  9042.  
  9043.  
  9044.           Instead  of typing all of these commands, you could group them into
  9045.      a shell script. We described shell scripts briefly  in  Section  4.12.1.
  9046.      The shell script used to run all of these commands would look like
  9047.  
  9048.  
  9049.  
  9050.           #!/bin/sh
  9051.           # A shell script to create and print the book
  9052.  
  9053.           cat chapter1 chapter2 chapter3 > book
  9054.           wc -l book
  9055.           lp book
  9056.  
  9057.  
  9058.           If this script was saved in the file makebook, you could simply use
  9059.      the command
  9060.  
  9061.  
  9062.           /home/larry# makebook
  9063.  
  9064.  
  9065.           to run all of the commands in the script. Shell  scripts  are  just
  9066.      plain text files; you can create them with an editor such as emacs or vi
  9067.      (4) .
  9068.  
  9069.  
  9070.           Let's look at this shell script.  The  first  line,  ``#!/bin/sh'',
  9071.      identifies  the  file as a shell script, and tells the shell how to exe¡
  9072.      cute the script. It instructs the shell to pass the  script  to  /bin/sh
  9073.      for  execution,  where  /bin/sh is the shell program itself. Why is this
  9074.      important? On most UNIX systems, /bin/sh is a Bourne-type shell, such as
  9075.      Bash.  By forcing the shell script to run using /bin/sh, we are ensuring
  9076.      that the script will run under a Bourne-syntax shell (instead of, say, a
  9077.      C  shell).  This  will  cause your script to run using the Bourne syntax
  9078.      even if you use Tcsh (or another C shell) as your login shell.
  9079.  
  9080.  
  9081.           The second line is a comment. Comments  begin  with  the  character
  9082.      ``#''  and  continue to the end of the line. Comments are ignored by the
  9083.      shell---they are commonly used to identify the shell script to the  pro¡
  9084.      grammer.
  9085.  
  9086.      
  9087.  
  9088.      4. vi is covered in Section 4.11.
  9089.  
  9090.                                 - 140 -
  9091.  
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.  
  9098.  
  9099.  
  9100.           The rest of the lines in the script are just commands, as you would
  9101.      type them to the shell directly. In effect, the shell reads each line of
  9102.      the  script  and  runs  that  line  as  if you had typed it at the shell
  9103.      prompt.
  9104.  
  9105.  
  9106.           Permissions are important for shell scripts. If you create a  shell
  9107.      script,  you  must  make  sure  that  you have execute permission on the
  9108.      script in order to run it(5) .  The command
  9109.  
  9110.  
  9111.           /home/larry# chmod u+x makebook
  9112.  
  9113.  
  9114.           can be used to give yourself execute permission on the shell script
  9115.      makebook.
  9116.  
  9117.  
  9118.      4.12.2  Shell variables and the environment
  9119.  
  9120.      The shell allows you to define variables, as most programming  languages
  9121.      do. A variable is just a piece of data which is given the name.
  9122.  
  9123.  
  9124.  <>       Note  that  Tcsh,  as  well as other C-type shells, use a different
  9125.      mechanism for setting variables than is described here. This  discussion
  9126.      assumes  the  use of a Bourne shell, such as Bash (which you're probably
  9127.      using). See the Tcsh man page for details.
  9128.  
  9129.  
  9130.           When you assign a value to a variable (using the  ``=''  operator),
  9131.      you  can access the variable by prepending a ``$'' to the variable name,
  9132.      as demonstrated below.
  9133.  
  9134.  
  9135.           /home/larry# foo="hello there"
  9136.  
  9137.  
  9138.           The variable foo is given the value ``hello there''.  You  can  now
  9139.      refer  to this value by the variable name, prefixed with a ``$'' charac¡
  9140.      ter. The command
  9141.  
  9142.  
  9143.           /home/larry# echo $foo
  9144.           hello there
  9145.           /home/larry#
  9146.  
  9147.           produces the same results as
  9148.  
  9149.  
  9150.  
  9151.  
  9152.      
  9153.  
  9154.      5. When you  create  text  files,  the  default  permissions
  9155.         usually don't include execute permission.
  9156.  
  9157.                                 - 141 -
  9158.  
  9159.  
  9160.  
  9161.  
  9162.  
  9163.  
  9164.  
  9165.  
  9166.  
  9167.           /home/larry# echo "hello there"
  9168.           hello there
  9169.           /home/larry#
  9170.  
  9171.  
  9172.  
  9173.           These variables are internal to the shell. This means that only the
  9174.      shell  can  access these variables. This can be useful in shell scripts;
  9175.      if you need to keep track of a filename, for example, you can  store  it
  9176.      in  a  variable,  as above. Using the command set will display a list of
  9177.      all defined shell variables.
  9178.  
  9179.  
  9180.           However, the shell allows you to export variables to  the  environ¡
  9181.      ment.  The  environment  is the set of variables which all commands that
  9182.      you execute have access to. Once you define a variable inside the shell,
  9183.      exporting  it  makes  that variable part of the environment as well. The
  9184.      export command is used to export a variable to the environment.
  9185.  
  9186.  
  9187.  <>       Again, here we differ between Bash and Tcsh. If you're using  Tcsh,
  9188.      another  syntax  is  used  for setting environment variables (the setenv
  9189.      command is used). See the Tcsh man page for more information.
  9190.  
  9191.  
  9192.           The environment is very important to the UNIX system. It allows you
  9193.      to  configure  certain commands just by setting variables which the com¡
  9194.      mands know about.
  9195.  
  9196.  
  9197.           Here's a quick example. The environment variable PAGER is  used  by
  9198.      the  man  command.  It specifies the command to use to display man pages
  9199.      one screenful at a time. If you set PAGER to be the name of  a  command,
  9200.      it  will  use  that  command  to  display the man pages, instead of more
  9201.      (which is the default).
  9202.  
  9203.  
  9204.           Set PAGER to ``cat''. This will cause output from man  to  be  dis¡
  9205.      played to the screen all at once, without breaking it up into pages.
  9206.  
  9207.  
  9208.           /home/larry# PAGER="cat"
  9209.  
  9210.  
  9211.           Now, export PAGER to the environment.
  9212.  
  9213.  
  9214.           /home/larry# export PAGER
  9215.  
  9216.  
  9217.           Try  the  command  man ls. The man page should fly past your screen
  9218.      without pausing for you.
  9219.  
  9220.  
  9221.  
  9222.  
  9223.                                 - 142 -
  9224.  
  9225.  
  9226.  
  9227.  
  9228.  
  9229.  
  9230.  
  9231.  
  9232.  
  9233.           Now, if we set PAGER to ``more'', the more command will be used  to
  9234.      display the man page.
  9235.  
  9236.  
  9237.           /home/larry# PAGER="more"
  9238.  
  9239.  
  9240.           Note  that  we don't have to use the export command after we change
  9241.      the value of PAGER. We only need to export a variable once; any  changes
  9242.      made  to  it thereafter will automatically be propagated to the environ¡
  9243.      ment.
  9244.  
  9245.  
  9246.           The man pages for a particular command will tell you if the command
  9247.      uses  any  environment variables; for example, the man man page explains
  9248.      that PAGER is used to specify the pager command.   Some  commands  share
  9249.      environment  variables;  for example, many commands use the EDITOR envi¡
  9250.      ronment variable to specify the  default  editor  to  use  when  one  is
  9251.      needed.
  9252.  
  9253.  
  9254.           The environment is also used to keep track of important information
  9255.      about your login session. An example is the HOME  environment  variable,
  9256.      which contains the name of your home directory.
  9257.  
  9258.  
  9259.           /home/larry/papers# echo $HOME
  9260.           /home/larry
  9261.  
  9262.  
  9263.  
  9264.  
  9265.           Another  interesting environment variable is PS1, which defines the
  9266.      main shell prompt. For example,
  9267.  
  9268.  
  9269.           /home/larry# PS1="Your command, please: "
  9270.           Your command, please:
  9271.  
  9272.  
  9273.           To set the prompt back to our usual  (which  contains  the  current
  9274.      working directory followed by a ``#'' symbol),
  9275.  
  9276.  
  9277.           Your command, please: PS1="\w# "
  9278.           /home/larry#
  9279.  
  9280.           The bash man page describes the syntax used for setting the prompt.
  9281.  
  9282.  
  9283.      4.12.2.1  The PATH environment variable
  9284.      When you use the ls command, how does the shell know where to  find  the
  9285.      ls  executable  itself? In fact, ls is found in /bin/ls on most systems.
  9286.      The shell uses the environment variable PATH to locate executable  files
  9287.  
  9288.  
  9289.                                 - 143 -
  9290.  
  9291.  
  9292.  
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.      for commands which you type.
  9300.  
  9301.  
  9302.           For example, your PATH variable may be set to:
  9303.  
  9304.  
  9305.           /bin:/usr/bin:/usr/local/bin:.
  9306.  
  9307.  
  9308.           This  is a list of directories for the shell to search, each direc¡
  9309.      tory separated by a ``:''. When you use the command ls, the shell  first
  9310.      looks for /bin/ls, then /usr/bin/ls, and so on.
  9311.  
  9312.  
  9313.           Note  that  the  PATH has nothing to do with finding regular files.
  9314.      For example, if you use the command
  9315.  
  9316.  
  9317.           /home/larry# cp foo bar
  9318.  
  9319.  
  9320.           The shell does not use PATH to locate the files foo and bar---those
  9321.      filenames are assumed to be complete. The shell only uses PATH to locate
  9322.      the cp executable.
  9323.  
  9324.  
  9325.           This saves you a lot of time; it  means  that  you  don't  have  to
  9326.      remember  where  all of the command executables are stored. On many sys¡
  9327.      tems, executables are scattered about in many places, such as  /usr/bin,
  9328.      /bin,  or  /usr/local/bin. Instead of giving the command's full pathname
  9329.      (such as /usr/bin/cp), you can simply set PATH to the list  of  directo¡
  9330.      ries that you want the shell to automatically search.
  9331.  
  9332.  
  9333.           Notice  that  PATH  contains  ``.'',  which  is the current working
  9334.      directory. This allows you to create a shell script or program  and  run
  9335.      it  as  a command from your current directory, without having to specify
  9336.      it directly (as in ./makebook). If a directory isn't on your PATH,  then
  9337.      the  shell  will  not  search it for commands to run---this includes the
  9338.      current directory.
  9339.  
  9340.  
  9341.      4.12.3  Shell initialization scripts
  9342.  
  9343.      In addition to shell scripts that you create,  there  are  a  number  of
  9344.      scripts that the shell itself uses for certain purposes. The most impor¡
  9345.      tant of these are your  initialization  scripts,  scripts  automatically
  9346.      executed by the shell when you login.
  9347.  
  9348.  
  9349.           The  initialization scripts themselves are simply shell scripts, as
  9350.      described above. However, they are very useful in setting up your  envi¡
  9351.      ronment by executing commands automatically when you login. For example,
  9352.      if you always use the mail command to check your mail  when  you  login,
  9353.  
  9354.  
  9355.                                 - 144 -
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.      you  place  the command in your initialization script so it will be exe¡
  9366.      cuted automatically.
  9367.  
  9368.  
  9369.           Both Bash and Tcsh distinguish between  a  login  shell  and  other
  9370.      invocations  of  the  shell.  A  login shell is a shell invoked at login
  9371.      time; usually, it's the only shell which you'll  use.  However,  if  you
  9372.      ``shell out'' of another program, such as vi, you start another instance
  9373.      of the shell, which isn't your login shell. In  addition,  whenever  you
  9374.      run  a  shell  script,  you  automatically start another instance of the
  9375.      shell to execute the script.
  9376.  
  9377.  
  9378.           The initialization files used by Bash are: /etc/profile (set up  by
  9379.      the  system  administrator,  executed  by all Bash users at login time),
  9380.      $HOME/.bash profile  (executed   by   a   login   Bash   session),   and
  9381.      $HOME/.bashrc  (executed  by  all  non-login  instances  of  Bash).   If
  9382.      .bash profile is not present, .profile is used instead.
  9383.  
  9384.  
  9385.           Tcsh uses  the  following  initialization  scripts:  /etc/csh.login
  9386.      (executed  by  all  Tcsh users at login time), $HOME/.tcshrc (executed a
  9387.      login time and by all new instances of Tcsh), and $HOME/.login (executed
  9388.      at login time, following .tcshrc).  If .tcshrc is not present, .cshrc is
  9389.      used instead.
  9390.  
  9391.  
  9392.           To fully understand the function of these  files,  you'll  need  to
  9393.      learn  more  about  the shell itself. Shell programming is a complicated
  9394.      subject, far beyond the scope of this book. See the man pages  for  bash
  9395.      and/or tcsh to learn more about customizing your shell environment.
  9396.  
  9397.  
  9398.      4.13  So You Want to Strike Out on Your Own?
  9399.  
  9400.      Hopefully  we  have provided enough information to give you a basic idea
  9401.      of how to use the system. Keep in mind that most of the interesting  and
  9402.      important  aspects  of  Linux  aren't  covered here---these are the very
  9403.      basics.  With this foundation, before long you'll be up and running com¡
  9404.      plicated  applications  and  fulfilling the potential of your system. If
  9405.      things don't seem exciting at first, don't despair---there is much to be
  9406.      learned.
  9407.  
  9408.  
  9409.           One indispensable tool for learning about the system is to read the
  9410.      man pages. While many of the man pages may appear confusing at first, if
  9411.      you  dig  beneath the surface there is a wealth of information contained
  9412.      therein.
  9413.  
  9414.  
  9415.           We also suggest reading a complete book on  using  a  UNIX  system.
  9416.      There  is  much more to UNIX than meets the eye---unfortunately, most of
  9417.      it is beyond the scope of this book. Some good UNIX books to look at are
  9418.      listed in Appendix A.
  9419.  
  9420.  
  9421.                                 - 145 -
  9422.  
  9423.  
  9424.  
  9425.  
  9426.  
  9427.  
  9428.  
  9429.  
  9430.  
  9431.      5.  System Administration
  9432.  
  9433.      This  chapter is an overview to Linux system administration, including a
  9434.      number of advanced features which aren't necessarily for system adminis¡
  9435.      trators only. Just as every dog has its day, every system has its admin¡
  9436.      istrator, and running the system is a very important and sometimes time-
  9437.      consuming job, even if you're the only user on your system.
  9438.  
  9439.  
  9440.           We  have tried to cover here the most important things about system
  9441.      administration you need to know when you use Linux, in sufficient detail
  9442.      to get you comfortably started.  In order to keep it short and sweet, we
  9443.      have only covered the very basics, and have skipped  many  an  important
  9444.      detail.  You  should  read the Linux System Administrator's Guide if you
  9445.      are serious about running Linux.  It will help you understand better how
  9446.      things  work,  and  how they hang together.  At least skim through it so
  9447.      that you know what it contains and know what kind of help you can expect
  9448.      from it.
  9449.  
  9450.  
  9451.      5.1  About Root, Hats, and the Feeling of Power
  9452.  
  9453.      As  you  know, UNIX differentiates between different users, so that what
  9454.      they do to each other and to the system can be regulated  (one  wouldn't
  9455.      want anybody to be able to read one's love letters, for instance).  Each
  9456.      user is given an account, which includes a username, home directory, and
  9457.      so  on.  In addition to accounts given to real people, there are special
  9458.      system-defined accounts which have special privileges.  The most  impor¡
  9459.      tant of these is the root account, for the username root.
  9460.  
  9461.  
  9462.      5.1.1  The root account
  9463.  
  9464.      Ordinary  users  are  generally restricted so that they can't do harm to
  9465.      anybody else on the system, just to themselves. File permissions on  the
  9466.      system  are  arranged such that normal users aren't allowed to delete or
  9467.      modify files in directories shared  by  all  users  (such  as  /bin  and
  9468.      /usr/bin.  Most  users also protect their own files with the appropriate
  9469.      file permissions so that other users can't access or modify those files.
  9470.  
  9471.  
  9472.           There  are  no  such  restrictions on root. The user root can read,
  9473.      modify, or delete any file on the system, change permissions and  owner¡
  9474.      ships  on any file, and run special programs, such as those which parti¡
  9475.      tion the drive or create filesystems.  The basic idea is that the person
  9476.      or  persons who run and take care of the system logs in as root whenever
  9477.      it is necessary to perform tasks that cannot be  executed  as  a  normal
  9478.      user.   Because  root  can do anything, it is easy to make mistakes that
  9479.      have catastrophic consequences when logged in using this account.
  9480.  
  9481.  
  9482.           For example, as a normal user,  if  you  inadvertently  attempt  to
  9483.      delete  all  of  the files in /etc, the system will not permit you to do
  9484.      so.  However, when logged in as root, the system won't complain at  all.
  9485.  
  9486.  
  9487.                                 - 146 -
  9488.  
  9489.  
  9490.  
  9491.  
  9492.  
  9493.  
  9494.  
  9495.  
  9496.  
  9497.      It  is  very  easy to trash your system when using root. The best way to
  9498.      prevent accidents is to:
  9499.  
  9500.  
  9501.              * Sit on your hands before you press `return' on a command which
  9502.                may  cause damage. For example, if you're about to clean out a
  9503.                directory, before hitting `return', re-read the entire command
  9504.                and make sure that it is correct.
  9505.  
  9506.  
  9507.              * Don't  get  accustomed to using root. The more comfortable you
  9508.                are in the role of the root user, the more likely you  are  to
  9509.                confuse your privileges with those of a normal user. For exam¡
  9510.                ple, you might think that you're  logged  in  as  larry,  when
  9511.                you're really logged in as root.
  9512.  
  9513.  
  9514.              * Use a different prompt for the root account. You should change
  9515.                root's .bashrc or .login file to set the shell prompt to some¡
  9516.                thing  other  than your regular user prompt. For example, many
  9517.                people use the character ``$'' in prompts for  regular  users,
  9518.                and reserve the character ``#'' for the root user prompt.
  9519.  
  9520.  
  9521.              * Only  login as root when absolutely necessary. And, as soon as
  9522.                you're finished with your work as root, log out. The less  you
  9523.                use  the  root account, the less likely you'll be to do damage
  9524.                on your system.
  9525.  
  9526.  
  9527.  
  9528.      Of course, there is a breed of UNIX hackers out there who use  root  for
  9529.      virtually  everything.  But every one of them has, at some point, made a
  9530.      silly mistake as root and trashed the system. The general rule is, until
  9531.      you're  familiar with the lack of restrictions on root, and are comfort¡
  9532.      able using the system without such restrictions,  login  as  root  spar¡
  9533.      ingly.
  9534.  
  9535.  
  9536.           Of  course,  everyone  makes  mistakes. Linus Torvalds himself once
  9537.      accidentally deleted the entire kernel directory  tree  on  his  system.
  9538.      Hours  of  work  were lost forever. Fortunately, however, because of his
  9539.      knowledge of the filesystem code, he was able to reboot the  system  and
  9540.      reconstruct the directory tree by hand on disk.
  9541.  
  9542.  
  9543.           Put another way, if you picture using the root account as wearing a
  9544.      special magic hat that gives you lots of power, so that you can, by wav¡
  9545.      ing  your  hand,  destroy  entire  cities, it is a good idea to be a bit
  9546.      careful about what you do with your hands.  Since it  is  easy  to  move
  9547.      your  hand  in  a  destructive way by accident, it is not a good idea to
  9548.      wear the magic hat when it is not needed, despite the wonderful feeling.
  9549.  
  9550.  
  9551.  
  9552.  
  9553.                                 - 147 -
  9554.  
  9555.  
  9556.  
  9557.  
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.      5.1.2  Abusing the system
  9564.  
  9565.      Along  with  the feeling of power comes the tendency to do harm. This is
  9566.      one of the grey areas of UNIX system administration, but  everyone  goes
  9567.      through  it at some point in time. Most users of UNIX systems never have
  9568.      the ability to wield this power---on university and business  UNIX  sys¡
  9569.      tems,  only  the  highly-paid and highly-qualified system administrators
  9570.      ever login is root. In fact, at many such institutions, the  root  pass¡
  9571.      word  is a highly guarded secret: it is treated as the Holy Grail of the
  9572.      institution. A large amount of hubbub is made about logging in as  root;
  9573.      it is portrayed as a wise and fearsome power, given only to an exclusive
  9574.      cabal.
  9575.  
  9576.  
  9577.           This kind of attitude towards the root account  is,  quite  simply,
  9578.      the  kind  of thing which breeds malice and contempt. Because root is so
  9579.      fluffed-up, when some users have their first  opportunity  to  login  as
  9580.      root  (either  on  a  Linux system or elsewhere), the tendency is to use
  9581.      root's privileges in a harmful manner. I have known  so-called  ``system
  9582.      administrators'' who read other user's mail, delete user's files without
  9583.      warning, and generally behave like children when given such  a  powerful
  9584.      ``toy''.
  9585.  
  9586.  
  9587.           Because  root  has  such  privilege on the system, it takes a great
  9588.      deal of  maturity  and  self-control  to  use  the  account  as  it  was
  9589.      intended---to  run  the system. There is an unspoken code of honor which
  9590.      exists between the system administrator and the users on the system. How
  9591.      would  you  feel if your system administrator was reading your e-mail or
  9592.      looking over your files? There is still no strong  legal  precedent  for
  9593.      electronic  privacy  on  time-sharing computer systems. On UNIX systems,
  9594.      the root user has the ability to forego all security and privacy  mecha¡
  9595.      nisms  on  the  system.   It  is important that the system administrator
  9596.      develop a trusting relationship with the users on the  system.  I  can't
  9597.      stress that enough.
  9598.  
  9599.  
  9600.      5.1.3  Dealing with users
  9601.  
  9602.      UNIX  security  is  rather  lax by design. Security on the system was an
  9603.      afterthought---the system was originally  developed  in  an  environment
  9604.      where users intruding upon other users was simply unheard of. Because of
  9605.      this, even with security measures, there is still the ability for normal
  9606.      users to do harm.
  9607.  
  9608.  
  9609.           System  administrators  can take two stances when dealing with abu¡
  9610.      sive users: they can be either paranoid or trusting. The paranoid system
  9611.      administrator  usually  causes more harm than he or she prevents. One of
  9612.      my favorite sayings is, ``Never attribute to malice anything  which  can
  9613.      be attributed to stupidity.'' Put another way, most users don't have the
  9614.      ability or knowledge to do real harm on the system.  90%  of  the  time,
  9615.      when  a user is causing trouble on the system (by, for instance, filling
  9616.      up the user partition with large files, or running multiple instances of
  9617.  
  9618.  
  9619.                                 - 148 -
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.      a  large  program),  the  user  is simply unaware that what he or she is
  9630.      doing is a problem. I have come down on users who were causing  a  great
  9631.      deal of trouble, but they were simply acting out of ignorance---not mal¡
  9632.      ice.
  9633.  
  9634.  
  9635.           When you deal with users who are causing potential  trouble,  don't
  9636.      be  accusative.  The  old rule of ``innocent until proven guilty'' still
  9637.      holds.  It is best to simply talk to the user, and  question  about  the
  9638.      trouble,  instead of causing a confrontation. The last thing you want to
  9639.      do is be on the user's bad side. This will  raise  a  lot  of  suspicion
  9640.      about  you---the system administrator---running the system correctly. If
  9641.      a user believes that you distrust or dislike them, they might accuse you
  9642.      of  deleting files or breaching privacy on the system. This is certainly
  9643.      not the kind of position that you want to be in.
  9644.  
  9645.  
  9646.           If you do find that a user has been  attempting  to  ``crack''  the
  9647.      system,  or was intentionally doing harm to the system, don't return the
  9648.      malicious behavior with malice of your own. Instead,  simply  provide  a
  9649.      warning---but  be flexible. In many cases, you may catch a user ``in the
  9650.      act'' of doing harm to the system---give them a warning. Tell  them  not
  9651.      to  let  it  happen  again.  However,  if you do catch them causing harm
  9652.      again, be absolutely sure that it is intentional. I can't even begin  to
  9653.      describe  the  number  of  cases  where it appeared as though a user was
  9654.      causing trouble, when in fact it was either an accident or a fault of my
  9655.      own.
  9656.  
  9657.  
  9658.      5.1.4  Setting the rules
  9659.  
  9660.      The  best  way to run a system is not with an iron fist. That may be how
  9661.      you run the military, but UNIX was not designed for such discipline.  It
  9662.      makes  sense  to  lay  down  a simple and flexible set of guidelines for
  9663.      users---but remember, the fewer rules you have, the less chance there is
  9664.      of  breaking them. Even if your rules for using the system are perfectly
  9665.      reasonable and clear, users will always at times break these rules with¡
  9666.      out intending to. This is especially true in the case of new UNIX users,
  9667.      who are just learning the ropes of the system. It's not  patently  obvi¡
  9668.      ous,  for  example,  that you shouldn't download a gigabyte of files and
  9669.      mail them to everyone on the system. Users need help  understanding  the
  9670.      rules, and why they are there.
  9671.  
  9672.  
  9673.           If  you do specify usage guidelines for your system, make sure that
  9674.      the reason behind a particular guideline is made clear.  If  you  don't,
  9675.      then  users will find all sorts of creative ways to get around the rule,
  9676.      and not know that they are in fact breaking it.
  9677.  
  9678.  
  9679.      5.1.5  What it all means
  9680.  
  9681.      We can't tell you how to run your system to the last detail. Most of the
  9682.      philosophy  depends  on  how  you're  using the system. If you have many
  9683.  
  9684.  
  9685.                                 - 149 -
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.  
  9694.  
  9695.      users, things are much different than if you only have a few  users,  or
  9696.      if  you're  the  only  user  on  the system. However, it's always a good
  9697.      idea---in any situation---to understand what being the  system  adminis¡
  9698.      trator really means.
  9699.  
  9700.  
  9701.           Being  the  system  administrator  doesn't  make you a UNIX wizard.
  9702.      There are many system admins out there who know very little about  UNIX.
  9703.      Likewise,  there are many ``normal'' users out there who know more about
  9704.      UNIX than any system administrator could. Also, being the system  admin¡
  9705.      istrator  does  not  allow  you  to  use malice against your users. Just
  9706.      because the system gives you the privilege to mess with user files  does
  9707.      not mean that you have any right to do so.
  9708.  
  9709.  
  9710.           Lastly, being the system administrator is really not a big deal. It
  9711.      doesn't matter if your system is a little 386 or a  Cray  supercomputer.
  9712.      Running  the  system  is the same, regardless. Knowing the root password
  9713.      isn't going to get you money, fame, or girls. It will allow you to main¡
  9714.      tain the system, and keep it running. That's it.
  9715.  
  9716.  
  9717.      5.2  Booting the System
  9718.  
  9719.      There  are  several  ways to boot the system, either from floppy or from
  9720.      the hard drive.
  9721.  
  9722.  
  9723.      5.2.1  Using a boot floppy
  9724.  
  9725.      Many people boot Linux using a ``boot floppy'' which contains a copy  of
  9726.      the  Linux  kernel.  This kernel has the Linux root partition coded into
  9727.      it, so it will know where to  look  on  the  hard  drive  for  the  root
  9728.      filesystem.  (The  rdev command can be used to set the root partition in
  9729.      the kernel image; see below.)  This is the type of floppy created by SLS
  9730.      during installation, for example.
  9731.  
  9732.  
  9733.           To  create  your  own boot floppy, first locate the kernel image on
  9734.      your hard disk. It should be in the  file  /Image  or  /etc/Image.  Some
  9735.      installations use the file /vmlinux for the kernel.
  9736.  
  9737.  
  9738.           You  may  instead  have  a  compressed  kernel. A compressed kernel
  9739.      uncompresses itself into memory at boot time, and  takes  up  much  less
  9740.      space  on  the  hard  drive.  If you have a compressed kernel, it may be
  9741.      found in the file /zImage or /etc/zImage.
  9742.  
  9743.  
  9744.           Once you know where the kernel is, set the root device in the  ker¡
  9745.      nel  image  to  the name of your Linux root partition with the rdev com¡
  9746.      mand. The format of the command is
  9747.  
  9748.  
  9749.  
  9750.  
  9751.                                 - 150 -
  9752.  
  9753.  
  9754.  
  9755.  
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761.           rdev <kernel-name> <root-device>
  9762.  
  9763.  
  9764.           where <kernel-name> is the name of the  kernel  image,  and  <root-
  9765.      device> is the name of the Linux root partition. For example, to set the
  9766.      root device in the kernel /etc/Image to /dev/hda2, use the command
  9767.  
  9768.  
  9769.           # rdev /etc/Image /dev/hda2
  9770.  
  9771.  
  9772.  
  9773.  
  9774.           rdev can set other options in the  kernel  as  well,  such  as  the
  9775.      default  SVGA  mode to use at boot time. Just use ``rdev'' with no argu¡
  9776.      ments to get a help message.
  9777.  
  9778.  
  9779.           After setting the root device, you can simply copy the kernel image
  9780.      to  the  floppy. Whenever copying data a floppy, it's a good idea to MS-
  9781.      DOS format the floppy first. This lays down the sector and track  infor¡
  9782.      mation  on  the floppy, so it can be detected as either high or low den¡
  9783.      sity.
  9784.  
  9785.  
  9786.           For example, to copy the kernel  in  the  file  /etc/Image  to  the
  9787.      floppy in /etc/fd0, use the command
  9788.  
  9789.  
  9790.           # cp /etc/Image /dev/fd0
  9791.  
  9792.  
  9793.  
  9794.  
  9795.           This floppy should now boot Linux.
  9796.  
  9797.  
  9798.      5.2.2  Using LILO
  9799.  
  9800.      Another method of booting is to use LILO, a program which resides in the
  9801.      boot sector of your hard disk. This program is executed when the  system
  9802.      is booted from the hard disk, and can automatically boot up Linux from a
  9803.      kernel image stored on the hard drive itself.
  9804.  
  9805.  
  9806.           LILO can also be used as a  first-stage  boot  loader  for  several
  9807.      operating  systems,  allowing you to select at boot time which operating
  9808.      system (such as Linux or MS-DOS) to boot. When you boot using LILO,  the
  9809.      default  operating  system  is booted unless you press `ctrl', `alt', or
  9810.      `shift' during the bootup sequence. If you press any of these keys,  you
  9811.      will  be  provided with a boot prompt, at which you type the name of the
  9812.      operating system to boot (such as ``linux'' or ``msdos'').  If you press
  9813.      `tab'  at the boot prompt, a listing of available operating systems will
  9814.      be provided.
  9815.  
  9816.  
  9817.                                 - 151 -
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.  
  9826.  
  9827.           LILO is located in the directory /etc/lilo (if you have  it).   The
  9828.      easy   way   to   install  LILO  is  to  edit  the  configuration  file,
  9829.      /etc/lilo/config, and then run the command
  9830.  
  9831.  
  9832.           # /etc/lilo/lilo
  9833.  
  9834.  
  9835.  
  9836.  
  9837.           The LILO configuration file contains a ``stanza'' for each  operat¡
  9838.      ing  system  that  you want to boot. The best way to demonstrate this is
  9839.      with an example LILO config file. The below setup is for a system  which
  9840.      has  a  Linux  root  partition  on /dev/hda1, and an MS-DOS partition on
  9841.      /dev/hda2.
  9842.  
  9843.  
  9844.  
  9845.           # Tell LILO to modify the boot record on /dev/hda (the first
  9846.           # non-SCSI hard drive). If you boot from a drive other than /dev/hda,
  9847.           # change the following line.
  9848.           boot = /dev/hda
  9849.  
  9850.           # Name of the boot loader. No reason to modify this unless you're doing
  9851.           # some serious hacking on LILO.
  9852.           install = /etc/lilo/boot.b
  9853.  
  9854.           # Have LILO perform some optimization.
  9855.           compact
  9856.  
  9857.           # Stanza for Linux root partition on /dev/hda1.
  9858.           image = /etc/Image   # Location of kernel
  9859.              label = linux     # Name of OS (for the LILO boot menu)
  9860.              root = /dev/hda1  # Location of root partition
  9861.              vga = ask         # Tell kernel to ask for SVGA modes at boot time
  9862.  
  9863.           # Stanza for MSDOS partition on /dev/hda2.
  9864.           other = /dev/hda2    # Location of partition
  9865.              table = /dev/hda  # Location of partition table for /dev/hda2
  9866.              label = msdos     # Name of OS (for boot menu)
  9867.  
  9868.  
  9869.  
  9870.  
  9871.           The first operating system stanza in the config file  will  be  the
  9872.      default  OS  for  LILO to boot. You can select another OS to boot at the
  9873.      LILO boot prompt, as discussed above.
  9874.  
  9875.  
  9876.           The program /etc/lilo/QuickInst will ask you questions  about  your
  9877.      setup and generate a LILO config file for you.
  9878.  
  9879.  
  9880.           Remember  that  every time you update the kernel image on disk, you
  9881.  
  9882.  
  9883.                                 - 152 -
  9884.  
  9885.  
  9886.  
  9887.  
  9888.  
  9889.  
  9890.  
  9891.  
  9892.  
  9893.      should rerun /etc/lilo/lilo in order for the changes to be reflected  on
  9894.      the boot sector of your drive.
  9895.  
  9896.  
  9897.           Also  note  that  if you use the ``root ='' line, above, there's no
  9898.      reason to use rdev to set the root partition in the kernel image.   LILO
  9899.      sets it for you at boot time.
  9900.  
  9901.  
  9902.           The Linux FAQ (see Appendix A) provides more information on LILO,
  9903.      including how to use LILO to boot with OS/2's Boot Manager.
  9904.  
  9905.  
  9906.      5.3  Shutting Down
  9907.  
  9908.      Shutting down a Linux system is a bit tricky. Remember that  you  should
  9909.      never  just  turn off the power or hit the reset switch while the system
  9910.      is running. The kernel keeps track of disk I/O in memory buffers. If you
  9911.      reboot  the  system  without  giving  the kernel the chance to write its
  9912.      buffers to disk, you can corrupt your filesystems.
  9913.  
  9914.  
  9915.           Other precautions are taken at shutdown time as well. All processes
  9916.      are  sent  a  signal,  which  allows them to die gracefully (writing and
  9917.      closing all files, and so on). Filesystems are unmounted for safety.  If
  9918.      you  wish, the system can also alert users that the system is going down
  9919.      and give them a change to log off.
  9920.  
  9921.  
  9922.           The easiest way to shutdown is with the shutdown command. The  for¡
  9923.      mat of the command is
  9924.  
  9925.  
  9926.           shutdown <time> <warning-message>
  9927.  
  9928.  
  9929.           The <time> argument is the time to shutdown the system (in the for¡
  9930.      mat hh:mm:ss), and <warning-message>  is  a  message  displayed  on  all
  9931.      user's  terminals  before  shutdown.  Alternately,  you  can specify the
  9932.      <time> as ``now'', to shutdown immediately. The -r option may  be  given
  9933.      to shutdown to reboot the system after shutting down.
  9934.  
  9935.  
  9936.           For example, to shutdown the system at 8:00pm, use the command
  9937.  
  9938.  
  9939.           # shutdown -r 20:00
  9940.  
  9941.  
  9942.  
  9943.  
  9944.           The  command halt may be used to force an immediate shutdown, with¡
  9945.      out any warning messages or grace period. halt is useful if  you're  the
  9946.      only  one using the system, and want to shut down the system and turn it
  9947.  
  9948.  
  9949.                                 - 153 -
  9950.  
  9951.  
  9952.  
  9953.  
  9954.  
  9955.  
  9956.  
  9957.  
  9958.  
  9959.      off.
  9960.  
  9961.  
  9962.  <>       Don't turn off the power or reboot the system  until  you  see  the
  9963.      message:
  9964.  
  9965.  
  9966.           The system is halted
  9967.  
  9968.  
  9969.           It is very important that you shutdown the system ``cleanly'' using
  9970.      the shutdown or halt commands. On some systems, pressing  `ctrl-alt-del'
  9971.      will  be  trapped and cause a shutdown; on other systems, however, using
  9972.      the ``Vulcan nerve pinch'' will reboot the system  immediately  and  may
  9973.      cause disaster.
  9974.  
  9975.  
  9976.      5.4  Managing Users
  9977.  
  9978.      Whether  or  not  you  have many users on your system, it's important to
  9979.      understand the aspects of user management under Linux.  Even  if  you're
  9980.      the  only  user, you should presumably have a separate account for your¡
  9981.      self (an account other than root to do most of your work).
  9982.  
  9983.  
  9984.           Each person using the system should have his or  her  own  account.
  9985.      It  is seldom a good idea to have several people share the same account.
  9986.      Not only is security an issue, but accounts are used to  uniquely  iden¡
  9987.      tify  users  to  the system. You need to be able to keep track of who is
  9988.      doing what.
  9989.  
  9990.  
  9991.      5.4.1  User management concepts
  9992.  
  9993.      The system keeps track of a number of pieces of information  about  each
  9994.      user. They are summarized below.
  9995.  
  9996.  
  9997.  
  9998.              * username  The username is the unique identifier given to every
  9999.                user on the system.  Examples of usernames  are  larry,  karl,
  10000.                and mdw.  Letters and digits may be used, as well as the char¡
  10001.                acters `` '' (underscore) and ``.''  (period).  Usernames  are
  10002.                usually limited to 8 characters in length.
  10003.  
  10004.  
  10005.              * user ID The user ID, or UID, is a unique number given to every
  10006.                user on the system. The system usually keeps track of informa¡
  10007.                tion by UID, not username.
  10008.  
  10009.  
  10010.              * group ID The group ID, or GID, is the ID of the user's default
  10011.                group. In Section 4.9 we  discussed  group  permissions;  each
  10012.                user  belongs  to  one  or  more  groups defined by the system
  10013.  
  10014.  
  10015.                                 - 154 -
  10016.  
  10017.  
  10018.  
  10019.  
  10020.  
  10021.  
  10022.  
  10023.  
  10024.  
  10025.                administrator.  More about this below.
  10026.  
  10027.  
  10028.              * password The system also stores the user's encrypted password.
  10029.                The passwd command is used to set and change user passwords.
  10030.  
  10031.  
  10032.              * full  name The user's ``real name'' or ``full name'' is stored
  10033.                along with the username. For example, the user schmoj may have
  10034.                the name ``Joe Schmo'' in real life.
  10035.  
  10036.  
  10037.              * home  directory  The  home directory is the directory in which
  10038.                the user is initially placed at login time. Every user  should
  10039.                have his or her own home directory, usually found under /home.
  10040.  
  10041.  
  10042.              * login shell The user's login  shell  is  the  shell  which  is
  10043.                started for the user at login time. Examples are /bin/bash and
  10044.                /bin/tcsh.
  10045.  
  10046.  
  10047.  
  10048.           The file /etc/passwd contains this information about  users.   Each
  10049.      line in the file contains information about a single user; The format of
  10050.      each line is
  10051.  
  10052.  
  10053.           username:encrypted password:UID:GID:full name:home direc¡
  10054.           tory:login shell
  10055.  
  10056.  
  10057.           An example might be:
  10058.  
  10059.  
  10060.           kiwi:Xv8Q981g71oKK:102:100:Laura Poole:/home/kiwi:/bin/bash
  10061.  
  10062.  
  10063.  
  10064.  
  10065.           As we can see, the first field, ``kiwi'', is the username.
  10066.  
  10067.  
  10068.           The next  field,  ``Xv8Q981g71oKK'',  is  the  encrypted  password.
  10069.      Passwords  are  not  stored  on the system in any human-readable format.
  10070.      The password is encrypted using itself  as  the  secret  key.  In  other
  10071.      words, you need to know the password to decrypt it. This form of encryp¡
  10072.      tion is fairly secure.
  10073.  
  10074.  
  10075.           Some systems use ``shadow password'' in which password  information
  10076.      is  relegated  to  the  file  /etc/shadow. Because /etc/passwd is world-
  10077.      readable, /etc/shadow provides some degree of extra security because  it
  10078.  
  10079.  
  10080.                                 - 155 -
  10081.  
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.      is  not.  Shadow  password provides some other features such as password
  10091.      expiration and so on; we will not go into these features here.
  10092.  
  10093.  
  10094.           The third field, ``102'', is the UID. This must be unique for  each
  10095.      user.  The  fourth  field, ``100'', is the GID. This user belongs to the
  10096.      group numbered 100. Group information, like user information, is  stored
  10097.      in the file /etc/group. See Section 5.4.5 for more information.
  10098.  
  10099.  
  10100.           The  fifth field is the user's full name, ``Laura Poole''. The last
  10101.      two fields are the user's home directory (/home/kiwi)  and  login  shell
  10102.      (/bin/bash),  respectively.  It  is  not  required  that the user's home
  10103.      directory be given the same name as the username.  It does help identify
  10104.      the directory, however.
  10105.  
  10106.  
  10107.      5.4.2  Adding users
  10108.  
  10109.      When adding a user, there are several steps to be taken. First, the user
  10110.      must be given an entry in /etc/passwd, with a unique username  and  UID.
  10111.      The  GID,  fullname, and other information must be specified. The user's
  10112.      home directory must be created, and the permissions on the directory set
  10113.      so  that the user owns the directory. Shell initialization files must be
  10114.      provided in the new home directory and other  system-wide  configuration
  10115.      must  be  done  (for example, setting up a spool for incoming e-mail for
  10116.      the new user).
  10117.  
  10118.  
  10119.           While it is not difficult to add users by hand (I do), when you are
  10120.      running  a  system  with many users it is easy to forget something.  The
  10121.      easiest way to add users is to use an interactive program which asks you
  10122.      for  the  required information and updates all of the system files auto¡
  10123.      matically. The name of this program is useradd or adduser, depending  on
  10124.      what  software was installed. The man pages for these commands should be
  10125.      fairly self-explanatory.
  10126.  
  10127.  
  10128.      5.4.3  Deleting users
  10129.  
  10130.      Similarly, deleting users can be accomplished with the commands  userdel
  10131.      or deluser depending on what software was installed on the system.
  10132.  
  10133.  
  10134.           If you'd like to temporarily "disable" a user from logging into the
  10135.      system (without deleting the user's account), you can simply prepend  an
  10136.      asterisk  (``*'')  to  the  password  field in /etc/passwd. For example,
  10137.      changing kiwi's /etc/passwd entry to
  10138.  
  10139.  
  10140.           kiwi:*Xv8Q981g71oKK:102:100:Laura Poole:/home/kiwi:/bin/bash
  10141.  
  10142.  
  10143.  
  10144.  
  10145.                                 - 156 -
  10146.  
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.           will restrict kiwi from logging in.
  10156.  
  10157.  
  10158.      5.4.4  Setting user attributes
  10159.  
  10160.      After  you  have  created  a user, you may need to change attributes for
  10161.      that user, such as home directory or password. The  easiest  way  to  do
  10162.      this  is  to  change the values directly in /etc/passwd. To set a user's
  10163.      password, use the passwd command. For example,
  10164.  
  10165.  
  10166.           # passwd larry
  10167.  
  10168.  
  10169.           will change larry's password. Only root  may  change  other  user's
  10170.      password  in  this  manner.  Users  can  change their own passwords with
  10171.      passwd as well.
  10172.  
  10173.  
  10174.           On some systems, the commands chfn and chsh will  be  available  to
  10175.      allow  users  to  set  their own fullname and login shell attributes. If
  10176.      not, they will have to ask the  system  administrator  to  change  these
  10177.      attributes for them.
  10178.  
  10179.  
  10180.      5.4.5  Groups
  10181.  
  10182.      As  we have mentioned, each user belongs to one or more groups. The only
  10183.      real importance of group relationships pertains to file permissions,  as
  10184.      you'll  recall from Section 4.9, each file has a ``group ownership'' and
  10185.      a set of group permissions which defines how users  in  that  group  may
  10186.      access the file.
  10187.  
  10188.  
  10189.           There are several system-defined groups such as bin, mail, and sys.
  10190.      Users should not belong to any of these groups; they are used for system
  10191.      file  permissions.  Instead,  users should belong to an individual group
  10192.      such as users. If you want to be cute, you can maintain  several  groups
  10193.      of users such as student, staff, and faculty.
  10194.  
  10195.  
  10196.           The  file /etc/group contains information about groups.  The format
  10197.      of each line is
  10198.  
  10199.  
  10200.           group name:password:GID:other members
  10201.  
  10202.  
  10203.           Some example groups might be:
  10204.  
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.                                 - 157 -
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.           root:*:0:
  10222.           users:*:100:mdw,larry
  10223.           guest:*:200:
  10224.           other:*:250:kiwi
  10225.  
  10226.  
  10227.           The first group, root, is a special system group reserved  for  the
  10228.      root  account. The next group, users, is for regular users. It has a GID
  10229.      of 100. The users mdw and larry are given access to this group. Remember
  10230.      that  in  /etc/passwd  each user was given a default GID. However, users
  10231.      may belong to more than one group, by adding their  usernames  to  other
  10232.      group  lines in /etc/group. The groups command lists what groups you are
  10233.      given access to.
  10234.  
  10235.  
  10236.           The third group, guest, is  for  guest  users,  and  other  is  for
  10237.      ``other'' users. The user kiwi is given access to this group as well.
  10238.  
  10239.  
  10240.           As  you  can  see,  the  ``password'' field of /etc/group is rarely
  10241.      used. It is sometimes used to set a password on group  access.  This  is
  10242.      seldom  necessary. To protect users from changing into priveleged groups
  10243.      (with the newgroup command), set the password field to ``*''.
  10244.  
  10245.  
  10246.           The commands addgroup or groupadd may be used to add groups to your
  10247.      system. Usually, it's easier just to add entries in /etc/group yourself,
  10248.      as no other configuration needs to be done to add a group. To  delete  a
  10249.      group, simply delete its entry in /etc/group.
  10250.  
  10251.  
  10252.      5.5  Archiving and Compressing Files
  10253.  
  10254.      Before we can talk about backups, we need to introduce the tools used to
  10255.      archive software on UNIX systems.
  10256.  
  10257.  
  10258.      5.5.1  Using tar
  10259.  
  10260.      The tar command is most often used to archive software.
  10261.  
  10262.  
  10263.           The format of the tar command is
  10264.  
  10265.  
  10266.           tar <options> <file1> <file2> ...<fileN>
  10267.  
  10268.  
  10269.           where <options> is the list of commands and options  for  tar,  and
  10270.      <file1>  through <fileN> is the list of files to add or extract from the
  10271.      archive.
  10272.  
  10273.  
  10274.           For example, the command
  10275.  
  10276.  
  10277.                                 - 158 -
  10278.  
  10279.  
  10280.  
  10281.  
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.           # tar cvf backup.tar /etc
  10288.  
  10289.  
  10290.           would  pack  all  of  the  files  in  /etc  into  the  tar  archive
  10291.      backup.tar.  The  first  argument  to  tar---``cvf''---is the tar ``com¡
  10292.      mand''. ``c'' tells tar to create a new archive file. The  ``v''  option
  10293.      forces tar into verbose mode---printing each filename as it is archived.
  10294.      The ``f'' option tells tar that the next argument---backup.tar---is  the
  10295.      name  of the archive to create. The rest of the arguments to tar are the
  10296.      file and directory names to add to the archive.
  10297.  
  10298.  
  10299.           The command
  10300.  
  10301.  
  10302.           # tar xvf backup.tar
  10303.  
  10304.  
  10305.           will extract the tar file  backup.tar  in  the  current  directory.
  10306.      This can sometimes be dangerous---when extracting files from a tar file,
  10307.      old files are overwritten.
  10308.  
  10309.  
  10310.           Furthermore, before extracting tar files it is  important  to  know
  10311.      where  the files should be unpacked. For example, let's say you archived
  10312.      the following files: /etc/hosts, /etc/group, and /etc/passwd. If you use
  10313.      the command
  10314.  
  10315.  
  10316.           # tar cvf backup.tar /etc/hosts /etc/group /etc/passwd
  10317.  
  10318.  
  10319.           the  directory  name  /etc/ is added to the beginning of each file¡
  10320.      name. In order to extract the files to the correct location,  you  would
  10321.      need to use the following commands:
  10322.  
  10323.  
  10324.           # cd /
  10325.           # tar xvf backup.tar
  10326.  
  10327.  
  10328.           because  files are extracted with the pathname saved in the archive
  10329.      file.
  10330.  
  10331.  
  10332.           If, however, you archived the files with the command
  10333.  
  10334.  
  10335.           # cd /etc
  10336.           # tar cvf hosts group passwd
  10337.  
  10338.  
  10339.           the directory name is not saved in the archive file. Therefore, you
  10340.      would  need to ``cd /etc'' before extracting the files.  As you can see,
  10341.  
  10342.  
  10343.                                 - 159 -
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.      how the tar file is created  makes  a  large  difference  in  where  you
  10354.      extract it. The command
  10355.  
  10356.  
  10357.           # tar tvf backup.tar
  10358.  
  10359.  
  10360.           may  be used to display an ``index'' of the tar file before unpack¡
  10361.      ing it. In this way you can see what  directory  the  filenames  in  the
  10362.      archive  are  stored  relative  to, and can extract the archive from the
  10363.      correct location.
  10364.  
  10365.  
  10366.      5.5.2  gzip and compress
  10367.  
  10368.      Unlike archiving programs for MS-DOS, tar does  not  automatically  com¡
  10369.      press  files  as  it  archives them. Therefore, if you are archiving two
  10370.      1-megabyte files, the resulting tar file will be two megabytes in  size.
  10371.      The  gzip  command  may be used to compress a file (the file to compress
  10372.      need not be a tar file). The command
  10373.  
  10374.  
  10375.           # gzip -9 backup.tar
  10376.  
  10377.  
  10378.           will compress backup.tar and leave you with backup.tar.gz, the com¡
  10379.      pressed version of the file. The -9 switch tells gzip to use the highest
  10380.      compression factor.
  10381.  
  10382.  
  10383.           The gunzip command may  be  used  to  uncompress  a  gzipped  file.
  10384.      Equivalently, you may use ``gzip -d''.
  10385.  
  10386.  
  10387.           gzip  is  a  relatively  new  tool  in the UNIX community. For many
  10388.      years, the compress command was used instead. However, because  of  sev¡
  10389.      eral factors(1) , compress is being phased out.
  10390.  
  10391.  
  10392.           compressed files end in the extension .Z. For example, backup.tar.Z
  10393.      is the compressed version of  backup.tar,  while  backup.tar.gz  is  the
  10394.      gzipped  version(2)  .  The  uncompress command is used to expand a com¡
  10395.      pressed file; gunzip knows how to handle compressed files as well.
  10396.  
  10397.  
  10398.  
  10399.  
  10400.  
  10401.      
  10402.  
  10403.      1. These  factors  include a software patent dispute against
  10404.         the compress algorithm and the fact  that  gzip  is  much
  10405.         more efficient than compress.
  10406.      2. To  add further confusion, for some time the extension .z
  10407.         (lowercase  ``z'')  was  used  for  gzipped  files.   The
  10408.         official gzip extension is now .gz.
  10409.  
  10410.                                 - 160 -
  10411.  
  10412.  
  10413.  
  10414.  
  10415.  
  10416.  
  10417.  
  10418.  
  10419.  
  10420.      5.5.3  Putting them together
  10421.  
  10422.      Therefore, to archive a group of files and compress the result, you  can
  10423.      use the commands:
  10424.  
  10425.  
  10426.           # tar cvf backup.tar /etc
  10427.           # gzip -9 backup.tar
  10428.  
  10429.  
  10430.           The  result  will  be  backup.tar.gz.  To unpack this file, use the
  10431.      reverse set of commands:
  10432.  
  10433.  
  10434.           # gunzip backup.tar.gz
  10435.           # tar xvf backup.tar
  10436.  
  10437.  
  10438.           Of course always make sure that you are in  the  correct  directory
  10439.      before unpacking a tar file.
  10440.  
  10441.  
  10442.           You  can  use some UNIX cleverness to do all of this on one command
  10443.      line, as in the following:
  10444.  
  10445.  
  10446.           # tar cvf - /etc | gzip -9c > backup.tar.gz
  10447.  
  10448.  
  10449.           Here, we are sending the tar file to ``-'', which stands for  tar's
  10450.      standard  output.  This  is piped to gzip, which compresses the incoming
  10451.      tar file, and the result is saved in backup.tar.gz.
  10452.  
  10453.  
  10454.           The -c option to gzip tells gzip to  send  its  output  to  stdout,
  10455.      which is redirected to backup.tar.gz.
  10456.  
  10457.  
  10458.           A single command used to unpack this archive would be:
  10459.  
  10460.  
  10461.           # gunzip -c backup.tar.gz | tar xvf -
  10462.  
  10463.  
  10464.           Again,  gunzip uncompresses the contents of backup.tar.gz and sends
  10465.      the resulting tar file to stdout. This is  piped  to  tar,  which  reads
  10466.      ``-'', this time referring to tar's standard input.
  10467.  
  10468.  
  10469.           Happily,  the  tar command also includes the -z option to automati¡
  10470.      cally compress/uncompress files on the fly. However, it does this as per
  10471.      the  compress  algorithm---it  does not use gzip.  (Please note that the
  10472.      newest versions of GNU tar do in fact use gzip when using the -z option.
  10473.      However, if you use a tar binary from the Stone Age, like me, then don't
  10474.  
  10475.  
  10476.                                 - 161 -
  10477.  
  10478.  
  10479.  
  10480.  
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.      expect -z to use gzip compression.)
  10487.  
  10488.  
  10489.           For example, the command
  10490.  
  10491.  
  10492.           # tar cvfz backup.tar.Z /etc
  10493.  
  10494.  
  10495.           is equivalent to
  10496.  
  10497.  
  10498.           # tar cvf backup.tar /etc
  10499.           # compress backup.tar
  10500.  
  10501.  
  10502.           Just as the command
  10503.  
  10504.  
  10505.           # tar xvfz backup.tar.Z
  10506.  
  10507.  
  10508.           may be used instead of
  10509.  
  10510.  
  10511.           # uncompress backup.tar.Z
  10512.           # tar xvf backup.tar
  10513.  
  10514.  
  10515.  
  10516.  
  10517.           Refer to the man pages for tar and gzip for more information.
  10518.  
  10519.  
  10520.      5.6  Using Floppies and Making Backups
  10521.  
  10522.      Floppies are usually used as backup media. If  you  don't  have  a  tape
  10523.      drive  connected to your system, floppy disks can be used (although they
  10524.      are slower and somewhat less reliable).
  10525.  
  10526.  
  10527.           You may also use floppies to hold individual filesystems---in  this
  10528.      way, you can mount the floppy to access the data on it.
  10529.  
  10530.  
  10531.      5.6.1  Using floppies for backups
  10532.  
  10533.      The  easiest  way to make a backup using floppies is with tar.  The com¡
  10534.      mand
  10535.  
  10536.  
  10537.           # tar cvfzM /dev/fd0 /
  10538.  
  10539.  
  10540.  
  10541.  
  10542.                                 - 162 -
  10543.  
  10544.  
  10545.  
  10546.  
  10547.  
  10548.  
  10549.  
  10550.  
  10551.  
  10552.           will make a complete backup of your system using the  floppy  drive
  10553.      /dev/fd0.  The ``M'' option to tar allows the backup to be a multivolume
  10554.      backup; that is, when one floppy is full, tar will prompt for the  next.
  10555.      The command
  10556.  
  10557.  
  10558.           # tar xvfzM /dev/fd0
  10559.  
  10560.  
  10561.           can  be  used to restore the complete backup.  This method can also
  10562.      be used if you have a tape drive (/dev/rmt0) connected to your system.
  10563.  
  10564.  
  10565.           Note that using the method, you must settle for the compress  algo¡
  10566.      rithm;  tar  doesn't use gzip with the ``z'' option.  Several other pro¡
  10567.      grams exist for making multiple-volume backups; the backflops program on
  10568.      tsx-11.mit.edu may come in handy.
  10569.  
  10570.  
  10571.           Making  a  complete backup of the system can be time- and resource-
  10572.      consuming.  Most system administrators use a incremental backup  policy,
  10573.      in  which  every  month  a complete backup is taken, and every week only
  10574.      those files which have been modified in the last week are backed up.  In
  10575.      this  case, if you trash your system in the middle of the month, you can
  10576.      simply restore the last full monthly backup, and then restore  the  last
  10577.      weekly backups as needed.
  10578.  
  10579.  
  10580.           The find command can be useful in locating files which have changed
  10581.      since a certain date. Several scripts for managing  incremental  backups
  10582.      can be found on sunsite.unc.edu.
  10583.  
  10584.  
  10585.      5.6.2  Using floppies as filesystems
  10586.  
  10587.      You  can  create  a  filesystem  on a floppy just as you would on a hard
  10588.      drive partition. For example,
  10589.  
  10590.  
  10591.           # mke2fs /dev/fd0 1440
  10592.  
  10593.  
  10594.           creates a filesystem on the floppy in /dev/fd0.  The  size  of  the
  10595.      filesystem  must correspond to the size of the floppy. High-density 3.5"
  10596.      disks are 1.44 megabytes, or 1440 blocks, in  size.  High-density  5.25"
  10597.      disks are 1200 blocks.
  10598.  
  10599.  
  10600.           In  order  to access the floppy, you must mount the filesystem con¡
  10601.      tained on it. The command
  10602.  
  10603.  
  10604.  
  10605.  
  10606.  
  10607.  
  10608.                                 - 163 -
  10609.  
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.           # mount -t ext2 /dev/fd0 /mnt
  10619.  
  10620.  
  10621.           will mount the floppy in /dev/fd0 on the directory /mnt.  Now,  all
  10622.      of  the  files  on  the floppy will appear under /mnt on your drive. The
  10623.      ``-t ext2'' specifies an ext2fs filesystem type.  If you created another
  10624.      type of filesystem on the floppy, you'll need to specify its type to the
  10625.      mount command.
  10626.  
  10627.  
  10628.           The ``mount  point''  (the  directory  where  you're  mounting  the
  10629.      filesystem) needs to exist when you use the mount command. If it doesn't
  10630.      exist, simply create it with mkdir.
  10631.  
  10632.  
  10633.           See Section 5.8 for more information on filesystems, mounting,  and
  10634.      mount points.
  10635.  
  10636.  
  10637.  <>       Note  that  any I/O to the floppy is buffered just as hard disk I/O
  10638.      is.  If you change data on the floppy, you may not see the  drive  light
  10639.      come  on  until  the kernel flushes its I/O buffers. It's important that
  10640.      you not remove a floppy before you unmount it; this can be done with the
  10641.      command
  10642.  
  10643.  
  10644.           # umount /dev/fd0
  10645.  
  10646.  
  10647.           Do  not  simply  switch  floppies as you would on an MS-DOS system;
  10648.      whenever you change floppies, umount the first one and mount the next.
  10649.  
  10650.  
  10651.      5.7  Upgrading and Installing New Software
  10652.  
  10653.      Another duty of the system administrator is upgrading and installing new
  10654.      software.
  10655.  
  10656.  
  10657.           The  Linux  community is very dynamic. New kernel releases come out
  10658.      every few weeks, and other software is updated almost as often.  Because
  10659.      of  this,  new  Linux users often feel the need to upgrade their systems
  10660.      constantly to keep up the the rapidly changing pace. Not  only  is  this
  10661.      unnecessary, it's a waste of time: to keep up with all of the changes in
  10662.      the Linux world, you would be spending all of your  time  upgrading  and
  10663.      none of your time using the system.
  10664.  
  10665.  
  10666.           So,  when  should  you  upgrade?  Some  people feel that you should
  10667.      upgrade when a new distribution release is made---for example, when  SLS
  10668.      comes  out  with  a  new  version. Many Linux users completely reinstall
  10669.      their system with the newest SLS release every time. This,  also,  is  a
  10670.      waste  of time. In general, changes to SLS releases are small. Download¡
  10671.      ing and reinstalling 30 disks when only 10% of  the  software  has  been
  10672.  
  10673.  
  10674.                                 - 164 -
  10675.  
  10676.  
  10677.  
  10678.  
  10679.  
  10680.  
  10681.  
  10682.  
  10683.  
  10684.      actually modified is, of course, pointless.
  10685.  
  10686.  
  10687.           The  best  way  to  upgrade  your  system is to do it by hand: only
  10688.      upgrade those software packages which you know that you should  upgrade.
  10689.      This scares a lot of people: they want to know what to upgrade, and how,
  10690.      and what will break if they don't upgrade. In  order  to  be  successful
  10691.      with  Linux,  it's  important to overcome your fears of ``doing it your¡
  10692.      self''--- which is what Linux is all about. In fact, once you have  your
  10693.      system  working and all software correctly configured, reinstalling with
  10694.      the newest SLS release will no doubt wipe all of your configuration  and
  10695.      things  will be broken again, just as they were when you first installed
  10696.      your system. Setting yourself back in this manner  is  unnecessary---all
  10697.      that  is needed is some know-how about upgrading your system, and how to
  10698.      do it right.
  10699.  
  10700.  
  10701.           You'll find that when you upgrade one component of your system that
  10702.      other  things  should not break. For example, most of the software on my
  10703.      system is left over from an ancient 0.96 MCC Interim installation.  Yet,
  10704.      I  run the newest version of the kernel and libraries with this software
  10705.      with no problem. For the most part, senselessly upgrading to  ``keep  up
  10706.      with the trend'' is not important at all. This isn't MS-DOS or Microsoft
  10707.      Windows. There is no important reason to run the newest version  of  all
  10708.      of  the  software. If you find that you would like or need features in a
  10709.      new version, then upgrade. If not, then  don't.  In  other  words,  only
  10710.      upgrade  what  you have to, and when you have to. Don't just upgrade for
  10711.      the sake of upgrading. That will waste a lot of time and  effort  trying
  10712.      to keep up.
  10713.  
  10714.  
  10715.           The  most  important software to upgrade on your system is the ker¡
  10716.      nel, the libraries, and the gcc compiler. These are the three  essential
  10717.      parts  of  your  system, and in some cases they all depend on each other
  10718.      for everything to work successfully. Most of the other software on  your
  10719.      system does not need to be upgraded periodically.
  10720.  
  10721.  
  10722.      5.7.1  Upgrading the kernel
  10723.  
  10724.      Upgrading  the kernel is simply a matter of getting the sources and com¡
  10725.      piling them yourself. You must compile the kernel yourself in  order  to
  10726.      enable or disable certain features, as well as to ensure that the kernel
  10727.      will be optimized to run on your machine. The process is quite painless.
  10728.  
  10729.  
  10730.           The kernel sources may be retrieved from any of the Linux FTP sites
  10731.      (see Section C.5 for a list). On sunsite.unc.edu, for instance, the ker¡
  10732.      nel  sources  are  found in /pub/Linux/kernel.  Kernel versions are num¡
  10733.      bered using a version number and a patchlevel.  For example, kernel ver¡
  10734.      sion  0.99  patchlevel  11  is  usually  written  as  0.99.pl11, or just
  10735.      0.99.11.
  10736.  
  10737.  
  10738.  
  10739.  
  10740.                                 - 165 -
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.           The  kernel  sources  are  released  as a gzipped tar file(3) . For
  10751.      example,  the  file  containing  the   0.99.pl11   kernel   sources   is
  10752.      linux-0.99.11.tar.gz.
  10753.  
  10754.  
  10755.           Unpack  this  tar  file from the directory /usr/src; it creates the
  10756.      directory /usr/src/linux which contains the kernel sources.  You  should
  10757.      delete  or  rename your existing /usr/src/linux before unpacking the new
  10758.      version.
  10759.  
  10760.  
  10761.           Once the sources are unpacked, you need to make sure that two  sym¡
  10762.      bolic  links in /usr/include are correct. To create these links, use the
  10763.      commands
  10764.  
  10765.  
  10766.           # ln -sf /usr/src/linux/include/linux /usr/include/linux
  10767.           # ln -sf /usr/src/linux/include/asm /usr/include/asm
  10768.  
  10769.  
  10770.           Once you have created these links once, there is no reason to  cre¡
  10771.      ate  them again when you install the next version of the kernel sources.
  10772.      (See Section 5.10.3 for more about symbolic links.)
  10773.  
  10774.  
  10775.           Note that in order to compile the kernel, you must have the gcc and
  10776.      g++  C and C++ compilers installed on your system.  You may need to have
  10777.      the most recent versions of these compilers: see Section  5.7.3,  below,
  10778.      for more information.
  10779.  
  10780.  
  10781.           To compile the kernel, first cd to /usr/src/linux.  Run the command
  10782.      make config. This command will prompt you for a number of  configuration
  10783.      options,  such  as  what filesystem types you wish to include in the new
  10784.      kernel.
  10785.  
  10786.  
  10787.           Next, edit /usr/src/linux/Makefile. Be sure that the definition for
  10788.      ROOT DEV  is correct---it defines the device uses as the root filesystem
  10789.      at boot time. The usual definition is
  10790.  
  10791.  
  10792.           ROOT DEV = CURRENT
  10793.  
  10794.  
  10795.           Unless you are changing your root filesystem device,  there  is  no
  10796.      reason to change this.
  10797.  
  10798.      
  10799.  
  10800.      3. Often, a patch file is  also  released  for  the  current
  10801.         kernel  version  which  allows  you to patch your current
  10802.         kernel sources from the last patchlevel  to  the  current
  10803.         one  (using  the  program patch). In most cases, however,
  10804.         it's usually easier to install the entire new version  of
  10805.         the kernel sources
  10806.  
  10807.                                 - 166 -
  10808.  
  10809.  
  10810.  
  10811.  
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.           Next,  run  the command make dep to fix all of the source dependen¡
  10818.      cies. This is a very important step.
  10819.  
  10820.  
  10821.           Finally, you're ready to compile the kernel. The command make Image
  10822.      will  compile  the  kernel  and  leave  the new kernel image in the file
  10823.      /usr/src/linux/Image. Alternately, the command make zImage will  compile
  10824.      a  compressed  kernel  image, which uncompresses itself at boot time and
  10825.      uses less drive space.
  10826.  
  10827.  
  10828.           Once you have the kernel compiled, you need to either copy it to  a
  10829.      boot floppy (with a command such as ``cp Image /dev/fd0'') or install it
  10830.      using LILO to boot from your hard drive.  See  Section  5.2.2  for  more
  10831.      information.
  10832.  
  10833.  
  10834.      5.7.2  Upgrading the libraries
  10835.  
  10836.      As  mentioned  before, most of the software on the system is compiled to
  10837.      use shared libraries, which contain common subroutines shared among dif¡
  10838.      ferent programs.
  10839.  
  10840.  
  10841.           If you see the message
  10842.  
  10843.  
  10844.           Incompatible library version
  10845.  
  10846.  
  10847.           when  attempting  to run a program, then you need to upgrade to the
  10848.      version of the libraries which the program requires. Libraries are back-
  10849.      compatible;  that  is, a program compiled to use an older version of the
  10850.      libraries should work with the new version of the  libraries  installed.
  10851.      However, the reverse is not true.
  10852.  
  10853.  
  10854.           The  newest  version of the libraries can be found on the Linux FTP
  10855.      sites.  On sunsite.unc.edu, they are  located  in  /pub/Linux/GCC.   The
  10856.      ``release''  files  there should explain what files you need to download
  10857.      and how to install them.  Briefly,  you  should  get  the  files  image-
  10858.      version.tar.gz  and  inc-version.tar.gz  where version is the version of
  10859.      the libraries to install, such as 4.4.1. These are  gzipped  tar  files;
  10860.      the  image  file  contains  the  library  images  to install in /lib and
  10861.      /usr/lib. The inc file contains include files to install in /usr/include
  10862.  
  10863.  
  10864.           The  release-version.tar.gz  should explain the installation proce¡
  10865.      dure in detail (the exact instructions vary for each release).  In  gen¡
  10866.      eral you need to install the library .a and .sa files in /usr/lib. These
  10867.      are the libraries used at compilation time.
  10868.  
  10869.  
  10870.           In addition, the shared library image  files,  libc.so.version  are
  10871.  
  10872.  
  10873.                                 - 167 -
  10874.  
  10875.  
  10876.  
  10877.  
  10878.  
  10879.  
  10880.  
  10881.  
  10882.  
  10883.      installed in /lib. These are the shared library images loaded at runtime
  10884.      by programs using the libraries. Each library has a symbolic link  using
  10885.      the major version number of the library in /lib.
  10886.  
  10887.  
  10888.           For  example,  the  libc  library version 4.4.1 has a major version
  10889.      number of 4. The file containing the library is  libc.so.4.4.1.  A  sym¡
  10890.      bolic  link of the name libc.so.4 is also in /lib pointing to this file.
  10891.      You need to change this symbolic link when upgrading the libraries.  For
  10892.      example,  when  upgrading from libc.so.4.4 to libc.so.4.4.1, you need to
  10893.      change the symbolic link to point to the new version.
  10894.  
  10895.  
  10896.  <>       It is very important that you change the symbolic link in one step,
  10897.      as  given below. If you somehow delete the symbolic link libc.so.4, then
  10898.      programs which depend on the link (including basic utilities like ls and
  10899.      cat)  will  stop  working.  Use the following command to update the sym¡
  10900.      bolic link libc.so.4 to point to the file libc.so.4.4.1:
  10901.  
  10902.  
  10903.           # ln -sf /lib/libc.so.4.4.1 /lib/libc.so.4
  10904.  
  10905.  
  10906.           You also need to change the symbolic link  libm.so.version  in  the
  10907.      same  manner.  If  you  are  upgrading  to  a  different  version of the
  10908.      libraries substitute to appropriate filenames above. The library release
  10909.      notice should explain the details. (See Section 5.10.3 for more informa¡
  10910.      tion about symbolic links.)
  10911.  
  10912.  
  10913.      5.7.3  Upgrading gcc
  10914.  
  10915.      The gcc C and C++ compiler is used to compile software on  your  system,
  10916.      most  importantly  the kernel. The newest version of gcc is found on the
  10917.      Linux FTP sites. On  sunsite.unc.edu,  it  is  found  in  the  directory
  10918.      /pub/Linux/GCC  (along  with  the libraries).  There should be a release
  10919.      file for the gcc distribution detailing what files you need to  download
  10920.      and how to install them.
  10921.  
  10922.  
  10923.      5.7.4  Upgrading other software
  10924.  
  10925.      Upgrading  other  software  is  usually just a matter of downloading the
  10926.      appropriate files and installing them. Most software for Linux  is  dis¡
  10927.      tributed  at  gzipped tar files, including either sources or binaries or
  10928.      both. If binaries are not included in the release, you may need to  com¡
  10929.      pile  them  yourself;  usually,  this means typing make in the directory
  10930.      where the sources are held.
  10931.  
  10932.  
  10933.           Reading the USENET newsgroup comp.os.linux.announce  for  announce¡
  10934.      ments  of new software releases is the easiest way to find out about new
  10935.      software. Whenever you are looking for software on an  FTP  site,  down¡
  10936.      loading  the  ls-lR  index file from the FTP site and using grep to find
  10937.  
  10938.  
  10939.                                 - 168 -
  10940.  
  10941.  
  10942.  
  10943.  
  10944.  
  10945.  
  10946.  
  10947.  
  10948.  
  10949.      the files in question is the easiest way to locate software. If you have
  10950.      archie  available  to  you,  it  can  be  of assistance as well(4) . See
  10951.      Appendix A for more details.
  10952.  
  10953.  
  10954.           One handy source of Linux software is  the  SLS  distribution  disk
  10955.      images.  Each  disk  contains  a  number  of .tgz files which are simply
  10956.      gzipped tar files. Instead of downloading the disks,  you  can  download
  10957.      the  desired  .tgz  files  from  the SLS directories on the FTP site and
  10958.      install them directly. If you run the SLS distribution,  the  sysinstall
  10959.      command  can be used to automatically load and install a complete series
  10960.      of disks. For example, the command
  10961.  
  10962.  
  10963.           # sysinstall -series t
  10964.  
  10965.  
  10966.           will install the entire SLS t series of disks. Of course,  most  of
  10967.      the  time  you  may not download or wish to install an entire series, in
  10968.      which case you'll need to unpack the .tgz files by hand.
  10969.  
  10970.  
  10971.           Again, it's usually not a good idea to upgrade by reinstalling with
  10972.      the  newest  version  of SLS, or another distribution. SLS in particular
  10973.      was not designed to be upgradeable. If you reinstall in  this  way,  you
  10974.      will  no  doubt wreck your current installation, including user directo¡
  10975.      ries and all of your customized configuration. The best way  to  upgrade
  10976.      software is piecewise; that is, if there is a program that you use often
  10977.      that has a new version, upgrade it. Otherwise, don't  bother.   Rule  of
  10978.      thumb:  If it ain't broke, don't fix it. If your current software works,
  10979.      there's no reason to upgrade.
  10980.  
  10981.  
  10982.      5.8  Managing Filesystems
  10983.  
  10984.      Another task of the system administrator is taking care of  filesystems.
  10985.      Most  of this job entails periodically checking the filesystems for dam¡
  10986.      age or corrupted files; many systems automatically check the filesystems
  10987.      at boot time.
  10988.  
  10989.  
  10990.      5.8.1  Mounting filesystems
  10991.  
  10992.      First, a few concepts about filesystems. Before a filesystem is accessi¡
  10993.      ble to the system, it must be mounted on some directory.   For  example,
  10994.      if  you  have  a  filesystem  on  a floppy, you must mount it under some
  10995.      directory, say /mnt, in order to access the files  on  it  (see  Section
  10996.      5.6.2).  After  mounting  the  filesystem  on that directory, all of the
  10997.      files in the filesystem appear in that directory. In  the  case  of  the
  10998.      floppy, the files on the floppy will appear in the directory /mnt. After
  10999.  
  11000.      
  11001.  
  11002.      4. If  you  don't  have  archie, you can telnet to an archie
  11003.         server such as archie.rutgers.edu,  login  as  ``archie''
  11004.         and use the command ``help''
  11005.  
  11006.                                 - 169 -
  11007.  
  11008.  
  11009.  
  11010.  
  11011.  
  11012.  
  11013.  
  11014.  
  11015.  
  11016.      unmounting the floppy, the directory /mnt will be empty.
  11017.  
  11018.  
  11019.           The same is true of filesystems on the hard drive. The system auto¡
  11020.      matically  mounts filesystems on your hard drive for you at bootup time.
  11021.      The so-called ``root filesystem'' is mounted on the directory /. If  you
  11022.      have a separate filesystem for /usr, for example, it is mounted on /usr.
  11023.      If you only have a root filesystem, all files (including those in  /usr)
  11024.      exist on that filesystem.
  11025.  
  11026.  
  11027.           The command mount is used to mount a filesystem. The command
  11028.  
  11029.  
  11030.           mount -av
  11031.  
  11032.  
  11033.           is  executed from the file /etc/rc (which is the system initializa¡
  11034.      tion file executed at boot time; see Section  5.10.1).   The  mount  -av
  11035.      command  obtains  information  on  filesystems and mount points from the
  11036.      file /etc/fstab. An example fstab file appears below.
  11037.  
  11038.  
  11039.  
  11040.           # device       directory      type     options
  11041.           /dev/hda2       /             ext2     defaults
  11042.           /dev/hda3       /usr          ext2     defaults
  11043.           /dev/hda4       none          swap     sw
  11044.           /proc           /proc         proc     none
  11045.  
  11046.  
  11047.  
  11048.  
  11049.           The first field is the device---the name of the partition to mount.
  11050.      The  second  field is the mount point. The third field is the filesystem
  11051.      type---such as ext2 (for ext2fs) or minix (for Minix  filesystems).  The
  11052.      last   field   contains   mount   options---usually,   this  is  set  to
  11053.      ``defaults''.
  11054.  
  11055.  
  11056.           As you can see, swap partitions are included in /etc/fstab as well.
  11057.      They  have a mount directory of none, and type swap.  The swapon -a com¡
  11058.      mand, executed from /etc/rc as well, is used to enable swapping  on  all
  11059.      swap devices listed in /etc/fstab.
  11060.  
  11061.  
  11062.           The  fstab file contains one special entry---for the /proc filesys¡
  11063.      tem. As mentioned in Section 4.10.1, the /proc  filesystem  is  used  to
  11064.      store  information  about system processes, available memory, and so on.
  11065.      If /proc is not mounted, commands such as ps will not work.
  11066.  
  11067.  
  11068.  <>       The mount command may only be used by root. This is to ensure secu¡
  11069.      rity  on  the  system;  you  wouldn't  want  regular  users mounting and
  11070.  
  11071.  
  11072.                                 - 170 -
  11073.  
  11074.  
  11075.  
  11076.  
  11077.  
  11078.  
  11079.  
  11080.  
  11081.  
  11082.      unmounting filesystems on a whim. There are  several  software  packages
  11083.      available  which  allow  regular  users to mount and unmount filesystems
  11084.      (floppies in particular) without compromising system security.
  11085.  
  11086.  
  11087.           The mount -av command actually mounts all  filesystems  other  than
  11088.      the root filesystem (in the table above, /dev/hda2). The root filesystem
  11089.      is automatically mounted at boot time by the kernel.
  11090.  
  11091.  
  11092.           Instead of using mount -av, you can mount a filesystem by hand. The
  11093.      command
  11094.  
  11095.  
  11096.           # mount -t ext2 /dev/hda3 /usr
  11097.  
  11098.  
  11099.           is  equivalent  to mounting the filesystem with the entry /dev/hda3
  11100.      in the fstab example file above.
  11101.  
  11102.  
  11103.           In general, you should never have to mount or  unmount  filesystems
  11104.      by  hand.   The  mount -av command in /etc/rc takes care of mounting the
  11105.      filesystems at boot time.  Filesystems are  automatically  unmounted  by
  11106.      the shutdown or halt commands before bringing the system down.
  11107.  
  11108.  
  11109.      5.8.2  Checking filesystems
  11110.  
  11111.      It  is  usually a good idea to check your filesystems for damage or cor¡
  11112.      rupt files every now and then. Some systems  automatically  check  their
  11113.      filesystems at boot time (with the appropriate commands in /etc/rc).
  11114.  
  11115.  
  11116.           The  command  used to check a filesystem depends on the type of the
  11117.      filesystem in question. For ext2fs filesystems (the most  commonly  used
  11118.      type), this command is e2fsck. For example, the command
  11119.  
  11120.  
  11121.           # e2fsck -av /dev/hda2
  11122.  
  11123.  
  11124.           will  check  the  ext2fs  filesystem on /dev/hda2 and automatically
  11125.      correct any errors.
  11126.  
  11127.  
  11128.           It is usually a good idea to unmount a filesystem  before  checking
  11129.      it. For example, the command
  11130.  
  11131.  
  11132.           # umount /dev/hda2
  11133.  
  11134.  
  11135.           will unmount the filesystem on /dev/hda2, after which you can check
  11136.  
  11137.  
  11138.                                 - 171 -
  11139.  
  11140.  
  11141.  
  11142.  
  11143.  
  11144.  
  11145.  
  11146.  
  11147.  
  11148.      it. The one exception is that you cannot unmount the root filesystem. In
  11149.      order to check the root filesystem when it's unmounted, you should use a
  11150.      maintenance boot/root diskette (see Section  5.11.1).  You  also  cannot
  11151.      unmount  a  filesystem if any of the files in it are ``busy''---that is,
  11152.      being used by a running process.  For  example,  you  cannot  unmount  a
  11153.      filesystem  if  any user's current working directory is on that filesys¡
  11154.      tem. You will receive a ``Device busy'' error if you attempt to  unmount
  11155.      a filesystem which is in use.
  11156.  
  11157.  
  11158.           Other  filesystem  types use different forms of the e2fsck command,
  11159.      such as efsck and xfsck. On some systems, you can simply use the command
  11160.      fsck, which will determine the filesystem type and execute the appropri¡
  11161.      ate command.
  11162.  
  11163.  
  11164.  <>       It is important that  you  reboot  your  system  immediately  after
  11165.      checking  a  filesystem if any corrections were made to that filesystem.
  11166.      For example, if e2fsck reports that it corrected  any  errors  with  the
  11167.      filesystem,  you  should  immediately shutdown -r in order to reboot the
  11168.      system. This is to allow the system to re-sync its information about the
  11169.      filesystem when e2fsck modifies it.
  11170.  
  11171.  
  11172.           Of  course,  the /proc filesystem never needs to be checked in this
  11173.      manner. /proc is a memory filesystem, managed directly by the kernel.
  11174.  
  11175.  
  11176.      5.9  Using a swap file
  11177.  
  11178.      Instead of reserving an individual partition for swap space, you can use
  11179.      a file. However, to do so you'll need install the Linux software and get
  11180.      everything going before you create the swap file.
  11181.  
  11182.  
  11183.           If you have a Linux system installed, you  can  use  the  following
  11184.      commands to create a swap file. Below, we're going to create a swap file
  11185.      of size 8208 blocks (about 8 megs).
  11186.  
  11187.  
  11188.           # dd if=/dev/zero of=/swap bs=1024 count=8208
  11189.  
  11190.  
  11191.           This command creates the swap file itself. Replace  the  ``count=''
  11192.      with the size of the swap file in blocks.
  11193.  
  11194.  
  11195.           # mkswap /swap 8208
  11196.  
  11197.  
  11198.           This  command will initialize the swapfile; again, replace the name
  11199.      and size of the swapfile with the appropriate values.
  11200.  
  11201.  
  11202.  
  11203.  
  11204.                                 - 172 -
  11205.  
  11206.  
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.           # /etc/sync
  11215.           # swapon /swap
  11216.  
  11217.  
  11218.           Now we are swapping on the file /swap which we have created,  after
  11219.      syncing, which ensures that the file has been written to disk.
  11220.  
  11221.  
  11222.           The  one  major drawback to using a swapfile in this manner is that
  11223.      all access to the swap file is done through the filesystem.  This  means
  11224.      that  the  blocks  which  make  up  the swap file may not be contiguous.
  11225.      Therefore, performance may not be as great as using  a  swap  partition,
  11226.      for  which  blocks  are  always  contiguous  and  I/O  requests are done
  11227.      directly to the device.
  11228.  
  11229.  
  11230.           Another drawback in using a swapfile is the chance to corrupt  your
  11231.      filesystem  data---when using large swap files, there is the chance that
  11232.      you can corrupt your filesystem if something goes  wrong.  Keeping  your
  11233.      filesystems  and swap partitions separate will prevent this from happen¡
  11234.      ing.
  11235.  
  11236.  
  11237.           Using a swap file can be very useful if you have a  temporary  need
  11238.      for  more  swap  space. For example, if you're compiling a large program
  11239.      and would like to speed things up somewhat, you can temporarily create a
  11240.      swap file and use it in addition to your regular swap space.
  11241.  
  11242.  
  11243.           To get rid of a swap file, first use swapoff, as in
  11244.  
  11245.  
  11246.           # swapoff /swap
  11247.  
  11248.  
  11249.           And you can safely delete the file.
  11250.  
  11251.  
  11252.           # rm /swap
  11253.  
  11254.  
  11255.  
  11256.  
  11257.           Remember  that  each swap file (or partition) may be as large as 16
  11258.      megabytes, but you may use up to 8 swap files or partitions on your sys¡
  11259.      tem.
  11260.  
  11261.  
  11262.      5.10  Miscellaneous Tasks
  11263.  
  11264.      Believe it or not, there are a number of housekeeping tasks for the sys¡
  11265.      tem administrator which don't fall into any major category.
  11266.  
  11267.  
  11268.  
  11269.  
  11270.                                 - 173 -
  11271.  
  11272.  
  11273.  
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.      5.10.1  System startup files
  11281.  
  11282.      When the system boots, a number of scripts are executed automatically by
  11283.      the  system  before any user logs in. Here is a description of what hap¡
  11284.      pens.
  11285.  
  11286.  
  11287.           At bootup time, the kernel spawns the process /etc/init.  init is a
  11288.      program  which  reads  its  configuration file, /etc/inittab, and spawns
  11289.      other processes based on the contents of this file. One of the important
  11290.      processes started from inittab is the /etc/getty process started on each
  11291.      virtual console.  The getty process grabs the VC for use, and  starts  a
  11292.      login  process  on  the  VC.  This  allows  you  to login on each VC; if
  11293.      /etc/inittab does not contain a getty process for a certain VC, you will
  11294.      not be able to login on that VC.
  11295.  
  11296.  
  11297.           Another  process  executed  from  /etc/inittab is /etc/rc, the main
  11298.      system initialization file. This file is a  simple  shell  script  which
  11299.      executes any initialization commands needed at boot time, such as mount¡
  11300.      ing the filesystems (see Section 5.8) and initializing swap space.
  11301.  
  11302.  
  11303.           Your system may execute other initialization scripts as well,  such
  11304.      as /etc/rc.local. /etc/rc.local usually contains initialization commands
  11305.      specific to your own system, such as setting the hostname (see the  next
  11306.      section).  rc.local  may  be  started  from /etc/rc or from /etc/inittab
  11307.      directly.
  11308.  
  11309.  
  11310.      5.10.2  Setting the hostname
  11311.  
  11312.      In a networked environment, the hostname is used to uniquely identify  a
  11313.      particular  machine, while in a standalone environment the hostname just
  11314.      gives the system personality and charm. It's like naming a pet: you  can
  11315.      always  address to your dog as ``The dog,'' but it's much more interest¡
  11316.      ing to assign the dog a name such as Spot or Woofie.
  11317.  
  11318.  
  11319.           Setting the system's hostname is a simple matter of using the host¡
  11320.      name  command. If you are on a network, your hostname should be the full
  11321.      hostname of your machine, such as goober.norelco.com. If you are not  on
  11322.      a  network of any kind, you can choose an arbitrary host and domainname,
  11323.      such as loomer.vpizza.com, shoop.nowhere.edu, or floof.org.
  11324.  
  11325.  
  11326.           When setting the hostname, the hostname must  appear  in  the  file
  11327.      /etc/hosts,  which  assigns  an  IP  address  to each host. Even if your
  11328.      machine is not on a network, you should include  your  own  hostname  in
  11329.      /etc/hosts.
  11330.  
  11331.  
  11332.           For  example, if you are not on a TCP/IP network, and your hostname
  11333.      is floof.org, simply include the following line in /etc/hosts:
  11334.  
  11335.  
  11336.                                 - 174 -
  11337.  
  11338.  
  11339.  
  11340.  
  11341.  
  11342.  
  11343.  
  11344.  
  11345.  
  11346.           127.0.0.1       floof.org localhost
  11347.  
  11348.  
  11349.           This assigns your hostname,  floof.org,  to  the  loopback  address
  11350.      127.0.0.1 (used if you're not on a network). The localhost alias is also
  11351.      assigned to this address.
  11352.  
  11353.  
  11354.           If you are on a TCP/IP network, however, your real IP  address  and
  11355.      hostname  should  appear in /etc/hosts. For example, if your hostname is
  11356.      goober.norelco.com, and your IP address is 128.253.154.32, add the  fol¡
  11357.      lowing line to /etc/hosts:
  11358.  
  11359.  
  11360.           128.253.154.32       goober.norelco.com
  11361.  
  11362.  
  11363.  
  11364.  
  11365.           If  your  hostname  does  not appear in /etc/hosts, you will not be
  11366.      able to set it.
  11367.  
  11368.  
  11369.           To set your hostname, simply use the hostname command. For example,
  11370.      the command
  11371.  
  11372.  
  11373.           # hostname -S goober.norelco.com
  11374.  
  11375.  
  11376.           sets  the  hostname to goober.norelco.com. In most cases, the host¡
  11377.      name command is executed from one of the system startup files,  such  as
  11378.      /etc/rc  or  /etc/rc.local. Edit these two files and change the hostname
  11379.      command found there to set your own hostname; upon rebooting the  system
  11380.      the hostname will be set to the new value.
  11381.  
  11382.  
  11383.      5.10.3  Managing file links
  11384.  
  11385.      Links allow you to give a single file multiple names. Files are actually
  11386.      identified to the system by their inode number, which is just the unique
  11387.      filesystem  identifier for the file(5) . A directory is actually a list¡
  11388.      ing of inode numbers with their corresponding filenames.  Each  filename
  11389.      in a directory is a link to a particular inode.
  11390.  
  11391.  
  11392.      5.10.3.1  Hard links
  11393.      The  ln command is used to create multiple links for one file. For exam¡
  11394.      ple, let's say that you have the file foo in a directory. Using  ls  -i,
  11395.      we can look at the inode number for this file.
  11396.  
  11397.  
  11398.  
  11399.      
  11400.  
  11401.      5. The command ls -i will display file inode numbers.
  11402.  
  11403.                                 - 175 -
  11404.  
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412.  
  11413.           # ls -i foo
  11414.           22192 foo
  11415.           #
  11416.  
  11417.           Here,  the file foo has an inode number of 22192 in the filesystem.
  11418.      We can create another link to foo, named bar:
  11419.  
  11420.  
  11421.           # ln foo bar
  11422.  
  11423.  
  11424.           With ls -i, we see that the two files have the same inode.
  11425.  
  11426.  
  11427.           # ls -i foo bar
  11428.           22192 bar   22192 foo
  11429.           #
  11430.  
  11431.           Now, accessing either foo or bar will access the same file. If  you
  11432.      make  changes to foo, those changes will be made to bar as well. For all
  11433.      purposes, foo and bar are the same file.
  11434.  
  11435.  
  11436.           These links are known as hard links because they directly create  a
  11437.      link  to  an  inode.  Note that you can only hard-link files on the same
  11438.      filesystem; symbolic links (see below) don't have this restriction.
  11439.  
  11440.  
  11441.           When you delete a file with rm, you are actually only deleting  one
  11442.      link to a file. If you use the command
  11443.  
  11444.  
  11445.           # rm foo
  11446.  
  11447.  
  11448.           then  only  the  link named foo is deleted; bar will still exist. A
  11449.      file is only actually deleted on the system when it has no links to  it.
  11450.      Usually,  files  have only one link, so using the rm command deletes the
  11451.      file. However, if a file has multiple links to it, using  rm  will  only
  11452.      delete  a  single link; in order to delete the file, you must delete all
  11453.      links to the file.
  11454.  
  11455.  
  11456.           The command ls -l will display the number of links to a file (among
  11457.      other information).
  11458.  
  11459.  
  11460.           # ls -l foo bar
  11461.           -rw-r--r--   2 root     root          12 Aug  5 16:51 bar
  11462.           -rw-r--r--   2 root     root          12 Aug  5 16:50 foo
  11463.           #
  11464.  
  11465.           The  second  column  in the listing, ``2'', specifies the number of
  11466.      links to the file.
  11467.  
  11468.  
  11469.                                 - 176 -
  11470.  
  11471.  
  11472.  
  11473.  
  11474.  
  11475.  
  11476.  
  11477.  
  11478.  
  11479.           As it turns out, a directory is actually  just  a  file  containing
  11480.      information  about link-to-inode translations. Also, every directory has
  11481.      at least two hard links in it: ``.'' (a link pointing  to  itself),  and
  11482.      ``..'' (a link pointing to the parent directory). The root directory (/)
  11483.      ``..'' link just points back to /.
  11484.  
  11485.  
  11486.      5.10.3.2  Symbolic links
  11487.      Symbolic links are another type of link,  which  work  differently  than
  11488.      hard  links  (as described above).  A symbolic link allows you to give a
  11489.      file another name, but it doesn't link the file by inode.
  11490.  
  11491.  
  11492.           The command ln -s will create a symbolic link to a file.  For exam¡
  11493.      ple, if we use the command
  11494.  
  11495.  
  11496.           # ln -s foo bar
  11497.  
  11498.  
  11499.  
  11500.           we  will  create the symbolic link bar pointing to the file foo. If
  11501.      we use ls -i, we will see that the  two  files  have  different  inodes,
  11502.      indeed.
  11503.  
  11504.  
  11505.           # ls -i foo bar
  11506.           22195 bar   22192 foo
  11507.           #
  11508.  
  11509.           However,  using ls -l, we see that the file bar is a symlink point¡
  11510.      ing to foo.
  11511.  
  11512.  
  11513.           # ls -l foo bar
  11514.           lrwxrwxrwx   1 root     root           3 Aug  5 16:51 bar -> foo
  11515.           -rw-r--r--   1 root     root          12 Aug  5 16:50 foo
  11516.           #
  11517.  
  11518.  
  11519.  
  11520.           The permission bits on a symbolic link are not  used  (they  always
  11521.      appear  as rwxrwxrwx). Instead, the permissions on the symbolic link are
  11522.      determined by the permissions on the target of the symbolic link (in our
  11523.      example, the file foo).
  11524.  
  11525.  
  11526.           Functionally,  hard links and symbolic links are similar, but there
  11527.      are some differences. For one thing, you can create a symbolic link to a
  11528.      file  which doesn't exist; the same is not true for hard links. Symbolic
  11529.      links are processed by the kernel differently than hard links are, which
  11530.      is  just a technical difference but sometimes an important one. Symbolic
  11531.      links are helpful because they identify what file they  point  to;  with
  11532.  
  11533.  
  11534.                                 - 177 -
  11535.  
  11536.  
  11537.  
  11538.  
  11539.  
  11540.  
  11541.  
  11542.  
  11543.  
  11544.      hard  links, there is no easy way to determine which files are linked to
  11545.      the same inode.
  11546.  
  11547.  
  11548.           Links are used in many places on the Linux system.  Symbolic  links
  11549.      are  especially important to the shared library images in /lib. See Sec¡
  11550.      tion 5.7.2 for more information.
  11551.  
  11552.  
  11553.      5.11  What To Do In An Emergency
  11554.  
  11555.      On some occasions, the system  administrator  will  be  faced  with  the
  11556.      unique  problem  of recovering from a complete disaster, such as forget¡
  11557.      ting the root password or trashing  filesystems.  The  best  advice  is,
  11558.      don't  panic.  Everyone  makes  stupid mistakes---that's the best way to
  11559.      learn about system administration: the hard way.
  11560.  
  11561.  
  11562.           Linux is not an unstable version of UNIX. In fact, I have had fewer
  11563.      problems  with  system hangs and panics than with commercial versions of
  11564.      UNIX on many platforms. Linux also benefits from a strong complement  of
  11565.      wizards who can help you get out of a bind.
  11566.  
  11567.  
  11568.           The  first thing you should do when investigating any problem is to
  11569.      attempt to fix it yourself. Poke around, see how things work.  Too  much
  11570.      of  the time, a system administrator will post a desperate plea for help
  11571.      before looking into the problem at all. Most of the  time,  you'll  find
  11572.      that  fixing  problems yourself is actually very easy. It is the path to
  11573.      guruhood.
  11574.  
  11575.  
  11576.           There are very few cases where reinstalling the system from scratch
  11577.      is  necessary.  Many new users accidentally delete some essential system
  11578.      file, and immediately reach for the installation disks. This  is  not  a
  11579.      good  idea. Before taking such drastic measures, investigate the problem
  11580.      and ask others to help fix things up.  In  almost  all  cases,  you  can
  11581.      recover your system from a maintenance diskette.
  11582.  
  11583.  
  11584.      5.11.1  Recovering using a maintenance diskette
  11585.  
  11586.      One  indispensable  tool  for  the system administrator is the so called
  11587.      ``boot/root disk''---a floppy which can be booted for a  complete  Linux
  11588.      system,  independent  of  your  hard drive. Boot/root disks are actually
  11589.      very simple---you create a root filesystem on the floppy, place  all  of
  11590.      the necessary utilities on it, and install LILO and a bootable kernel on
  11591.      the floppy. Another technique is to use one floppy for  the  kernel  and
  11592.      another  for  the  root filesystem. In any case, the result is the same:
  11593.      you are running a Linux system completely from floppy.
  11594.  
  11595.  
  11596.           The  canonical  example of a boot/root disk is the SLS a1 disk(6) .
  11597.  
  11598.      
  11599.  
  11600.  
  11601.                                 - 178 -
  11602.  
  11603.  
  11604.  
  11605.  
  11606.  
  11607.  
  11608.  
  11609.  
  11610.  
  11611.      This disk contains a bootable kernel  and  a  root  filesystem,  all  on
  11612.      floppy.  Usually,  it's  used  only when installing SLS, but it comes in
  11613.      very handy when doing system maintenance.
  11614.  
  11615.  
  11616.           The H.J Lu boot/root disk, available from  /pub/Linux/GCC  on  sun¡
  11617.      site.unc.edu,  is  another  example  of  such a maintenance disk. Or, if
  11618.      you're ambitious, you can create your own boot/root disk. In most cases,
  11619.      however,  using a pre-made boot/root disk is much easier and will proba¡
  11620.      bly be more complete.
  11621.  
  11622.  
  11623.           Using a boot/root disk is very simple. Just boot the disk  on  your
  11624.      system,  and login as root (usually no password). In order to access the
  11625.      files on your hard drive, you will need to  mount  your  filesystems  by
  11626.      hand. For example, the command
  11627.  
  11628.  
  11629.           # mount -t ext2 /dev/hda2 /mnt
  11630.  
  11631.  
  11632.           will  mount an ext2fs filesystem on /dev/hda2 under /mnt.  Remember
  11633.      that / is now on the boot/root disk itself; you need to mount your  hard
  11634.      drive  filesystems  under  some  directory in order to access the files.
  11635.      Therefore, /etc/passwd on your hard drive is now /mnt/etc/passwd if  you
  11636.      mount your root filesystem on /mnt.
  11637.  
  11638.  
  11639.      5.11.2  Fixing the root password
  11640.  
  11641.      If  you  forget  your root password, no problem. Just boot the boot/root
  11642.      disk, mount your root filesystem on /mnt, and  blank  out  the  password
  11643.      field for root in /mnt/etc/password, as so:
  11644.  
  11645.  
  11646.           root::0:0:root:/:/bin/sh
  11647.  
  11648.  
  11649.           Now  root  has no password; when you reboot from the hard drive you
  11650.      should be able to login as root and reset the password using passwd.
  11651.  
  11652.  
  11653.           Aren't you glad you learned how to use vi? On your boot/root  disk,
  11654.      other editors such as Emacs probably aren't available, but vi should be.
  11655.  
  11656.  
  11657.      5.11.3  Fixing trashed filesystems
  11658.  
  11659.      If you somehow trash your filesystems, you can run e2fsck  (if  you  use
  11660.  
  11661.      
  11662.  
  11663.      6. See Section 3.1.1 for information on downloading the  SLS
  11664.         release  from the Internet. For this procedure, you don't
  11665.         need to download the entire  SLS  release---only  the  a1
  11666.         disk
  11667.  
  11668.                                 - 179 -
  11669.  
  11670.  
  11671.  
  11672.  
  11673.  
  11674.  
  11675.  
  11676.  
  11677.  
  11678.      the  ext2fs filesystem type, that is) to correct any damaged data on the
  11679.      filesystems from floppy. Other filesystem types use different  forms  of
  11680.      the e2fsck command; see Section 5.8 for details.
  11681.  
  11682.  
  11683.           When  checking  your  filesystems  from  floppy,  it's best for the
  11684.      filesystems to not be mounted.
  11685.  
  11686.  
  11687.      5.11.4  Recovering lost files
  11688.  
  11689.      If you accidentally deleted important files on your system,  there's  no
  11690.      way  to ``undelete'' them. However, you can copy the relevant files from
  11691.      the floppy to your hard drive. For example, if you deleted /bin/login on
  11692.      your  system  (which  allows  you  to  login), simply boot the boot/root
  11693.      floppy, mount the root filesystem on /mnt, and use the command
  11694.  
  11695.  
  11696.           # cp -a /bin/login /mnt/bin/login
  11697.  
  11698.  
  11699.           The -a option tells cp to preserve the permissions on  the  file(s)
  11700.      being copied.
  11701.  
  11702.  
  11703.           Of  course, if the files you deleted weren't essential system files
  11704.      which have counterparts on the boot/root floppy, you're out of luck.  If
  11705.      you made backups, you can always restore from them.
  11706.  
  11707.  
  11708.      5.11.5  Fixing trashed libraries
  11709.  
  11710.      If  you  accidentally  trashed your libraries or symbolic links in /lib,
  11711.      more than likely commands which depended  on  those  libraries  will  no
  11712.      longer  run  (see  Section  5.7.2). The easiest solution is to boot your
  11713.      boot/root floppy, mount your root filesystem, and fix the  libraries  in
  11714.      /mnt/lib.
  11715.  
  11716.  
  11717.  
  11718.  
  11719.  
  11720.  
  11721.  
  11722.  
  11723.  
  11724.  
  11725.  
  11726.  
  11727.  
  11728.  
  11729.  
  11730.  
  11731.  
  11732.  
  11733.  
  11734.                                 - 180 -
  11735.  
  11736.  
  11737.  
  11738.  
  11739.  
  11740.  
  11741.  
  11742.  
  11743.  
  11744.      6.  Advanced Features
  11745.  
  11746.      This chapter will introduce you to some of the more interesting features
  11747.      of Linux. This assumes that you have at least basic UNIX experience, and
  11748.      understand the information contained in the previous chapters.
  11749.  
  11750.  
  11751.           The most important aspect of Linux that distinguishes it from other
  11752.      implementations of UNIX is its open design and philosophy. Linux was not
  11753.      developed by a small team of programmers headed by a marketing committee
  11754.      with a single goal in mind. It was developed by an ever-increasing group
  11755.      of  hackers,  putting what they wanted into a homebrew UNIX system.  The
  11756.      types of software and diversity of design in the Linux world  is  large.
  11757.      Some  people  dislike  this lack of uniformity and conformity---however,
  11758.      some call it one of the strongest qualities of Linux.
  11759.  
  11760.  
  11761.      6.1  The X Window System
  11762.  
  11763.      The X Window System is a  large  and  powerful  (and  somewhat  complex)
  11764.      graphics  environment  for UNIX systems. The original X Windows code was
  11765.      developed at MIT; commercial vendors have  since  made  X  the  industry
  11766.      standard  for  UNIX  platforms. Virtually every workstation in the world
  11767.      runs some variant of X Windows.
  11768.  
  11769.  
  11770.           A free port of the MIT X Windows version 11, release 5 (X11R5)  for
  11771.      80386/80486  UNIX  systems  has  been developed by a team of programmers
  11772.      headed  by David Wexelblat(1) . The release, known as XFree86, is avail¡
  11773.      able for System V/386, 386BSD,  and  other  i386  UNIX  implementations,
  11774.      including  Linux.  It  includes  all  of  the required binaries, support
  11775.      files, libraries, and tools.
  11776.  
  11777.  
  11778.           Configuring and using the X Window System is far beyond  the  scope
  11779.      of  this  book.  You  are  encouraged to read The X Window System User's
  11780.      Guide, by Valerie Quercia and Tim O'Reilly. See Appendix A for  infor¡
  11781.      mation  on this book.  In this section, we'll give a general overview of
  11782.      installing and configuring X Windows for Linux, but it is far from  com¡
  11783.      plete.  The man pages and README files included with the Linux X Windows
  11784.      distribution should be very helpful.
  11785.  
  11786.  
  11787.           The Linux XFree86 HOWTO (see Appendix A for details)  contains  a
  11788.      complete  discussion  of installation and configuration of X Windows for
  11789.      Linux. We refer all interested readers to this document.
  11790.  
  11791.  
  11792.      6.1.1  Hardware requirements
  11793.  
  11794.      XFree86 supports a wide range of video controllers and monitors.  As  of
  11795.  
  11796.      
  11797.  
  11798.      1. David   may   be   reached    on    the    Internet    at
  11799.         dwex@mtgzfs3.att.com.
  11800.  
  11801.                                 - 181 -
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.      XFree86-2.0, the following SVGA chipsets are supported(2) .
  11812.  
  11813.  
  11814.           Nonaccelerated chipsets: Tseng ET3000, ET4000AX, ET4000/W32;  West¡
  11815.      ern  Digital/Paradise  PVGA1; Western Digital WD90C00, WD90C10, WD90C11,
  11816.      WD90C30;  Genoa  GVGA;   Trident   TVGA8800CS,   TVGA8900B,   TVGA8900C,
  11817.      TVGA8900CL,  TVGA9000; ATI 28800-4, 28800-5, 28800-a; NCR 77C22, 77C22E;
  11818.      Cirrus Logic GLGD5420, CLGD5422, CLGD5424, CLGD6205, CLGD6215, CLGD6225,
  11819.      CLGD6235; Compaq AVGA; OAK OTI067, OTI077.
  11820.  
  11821.  
  11822.           Accelerated  chipsets:  Cirrus  CLGD5426, CLGD5428; Western Digital
  11823.      WD90C31.
  11824.  
  11825.  
  11826.           These chipsets are all supported in 256 color and  monochrome  mode
  11827.      with  the  exception of the ATI and Cirrus chipsets, which are only sup¡
  11828.      ported in 256 color mode. Note that the ET4000/W32 is only supported  as
  11829.      a ET4000 clone and none of the accelerated functions are used.
  11830.  
  11831.  
  11832.           The monochrome server also supports generic VGA cards (using 64k of
  11833.      the video memory as a single bank), the Hercules card  and  the  Hyundai
  11834.      HGC-1280.
  11835.  
  11836.  
  11837.           XFree86-2.0  supports the following accelerated chipsets with sepa¡
  11838.      rate servers.  S3 86C911, 86C924, 86C801, 86C805, 86C928; ATI mach8; ATI
  11839.      mach32; and IBM 8514/a.
  11840.  
  11841.  
  11842.           No  other  chipsets  are supported; not Weitek P9000, not TIGA, not
  11843.      IIT AGX, not Microfield, etc.  Support for some of these will likely  be
  11844.      provided  in  future XFree86 releases.  TIGA will never be supported, as
  11845.      it requires licensing materials from TI (and may disallow source distri¡
  11846.      butions); Microfield boards will never be supported, as they use propri¡
  11847.      etary and undocumented custom microcode interfaces.
  11848.  
  11849.  
  11850.           Video cards from Diamond have always been problematic.  The follow¡
  11851.      ing  is a statement of the XFree86 Core Team concerning graphic cards by
  11852.      Diamond.
  11853.  
  11854.  
  11855.  
  11856.  
  11857.  
  11858.  
  11859.  
  11860.  
  11861.  
  11862.      
  11863.  
  11864.      2. This  information is adapted from the Linux XFree86-HOWTO
  11865.         by Helmut Geyer.
  11866.  
  11867.                                 - 182 -
  11868.  
  11869.  
  11870.  
  11871.  
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.           ``All Diamond cards are not supported by XFree86 even  if
  11878.           they  have a supported chipset (with the exception of the
  11879.           Cirrus chipsets that have an internal  clock  generator).
  11880.           The  reason  for  this  is  that Diamond has changed  the
  11881.           mechanism used to select  pixel   clock  frequencies, and
  11882.           will  only   release  programming information under  non-
  11883.           disclosure.   We are not willing to do this (as it  would
  11884.           mean   that source cannot be provided).  We have had dis¡
  11885.           cussions with Diamond over this, and they do not   intend
  11886.           to   change   this policy.  Hence  we will do nothing  to
  11887.           support Diamond  products   going  forward  (i.e.   don't
  11888.           send  us  a  program  to run  set their clocks).  XFree86
  11889.           does not support  Diamond hardware.  It  is  possible  to
  11890.           make  some  of it work, but  we will not assist  in doing
  11891.           this.''
  11892.  
  11893.  
  11894.  
  11895.           Local bus cards are supported as  well.  The  suggested  setup  for
  11896.      XFree86  under  Linux is a 486 machine with at least 8 megabytes of RAM,
  11897.      and an ET4000 VESA local bus video card. This is the  ``generic''  setup
  11898.      which  is known to work and is quite fast. Of course, you must also have
  11899.      a VESA local bus motherboard in order to use the local bus  video  card.
  11900.      I  have run XFree86 on a 486/50 MHz machine with 8 megs of RAM, and it's
  11901.      as fast or faster than many color workstations running proprietary  ver¡
  11902.      sions of UNIX and X.
  11903.  
  11904.  
  11905.           You  will  need  at  least  4  megabytes  of  physical  RAM, and 16
  11906.      megabytes of virtual RAM (for example, 8 megs physical and 8 megs swap).
  11907.      Remember that physical RAM is speed! A system with 4 megabytes of physi¡
  11908.      cal RAM will run much (up to 10 times) more slowly than one with 8  megs
  11909.      or  more.  Furthermore,  swapping  is too slow to compensate for lack of
  11910.      physical RAM.  It is strongly suggested that you have at least 8 megs of
  11911.      physical RAM.
  11912.  
  11913.  
  11914.      6.1.2  Software requirements
  11915.  
  11916.      In  order to use XFree86-2.0, you will need to be running kernel version
  11917.      0.99.pl12 or higher. You will also need to have version 4.4.1  or  newer
  11918.      of the libraries installed. Also required is ld.so version 1.3 or newer.
  11919.      ld.so is a shared dynamic linker for runtime used by newer  versions  of
  11920.      the  libraries.  See  Chapter 5. for information on upgrading the kernel
  11921.      and libraries.
  11922.  
  11923.  
  11924.           XFree86-2.0 requires at least 17 megabytes of free disk  space,  21
  11925.      megabytes  if  you  install  the server link kit. You may of course trim
  11926.      this figure down considerably by not installing many of the ``optional''
  11927.      packages available with XFree86, such as man pages.
  11928.  
  11929.  
  11930.  
  11931.  
  11932.  
  11933.                                 - 183 -
  11934.  
  11935.  
  11936.  
  11937.  
  11938.  
  11939.  
  11940.  
  11941.  
  11942.  
  11943.      6.1.3  Installing XFree86
  11944.  
  11945.      The  Linux  binary  distribution  of XFree86 can be found on a number of
  11946.      Linux FTP sites. On  sunsite.unc.edu,  it  is  found  in  the  directory
  11947.      /pub/Linux/X11/XFree86-2.0. (As of the time of this writing, the current
  11948.      version is 2.0; newer versions are released periodically).   The  binary
  11949.      distribution  consists  of  a  number of gzipped tar files, all of which
  11950.      unpack from /. Installation is very simple; just unpack these tar  files
  11951.      and everything should go into the right place.
  11952.  
  11953.  
  11954.           You  will need to get at least one of the servers (filenames begin¡
  11955.      ning with ``XF86'' in all caps) as well as the client programs and  sup¡
  11956.      port files. Those files which are optional are labelled as such.
  11957.  
  11958.  
  11959.      +-------------------------------------------------------------+
  11960.      |                                                             |
  11961.      |Package Name            Description                          |
  11962.      |                                                             |
  11963.      |XF86 SVGA.tar.gz        An SVGA server                       |
  11964.      |                        (most chipsets use this)             |
  11965.      |XF86 8514.tar.gz        An accelerated server for            |
  11966.      |                        cards using IBM8514 chips            |
  11967.      |XF86 Mach32.tar.gz      An accelerated server for            |
  11968.      |                        cards using Mach32 chips             |
  11969.      |XF86 Mach8.tar.gz       An accelerated server for            |
  11970.      |                        cards using Mach8 chips              |
  11971.      |XF86 Mono.tar.gz        A Monochrome server                  |
  11972.      |XF86 S3.tar.gz          An accelerated server for            |
  11973.      |                        cards using S3 chips                 |
  11974.      |XF86 VGA16.tar.gz       An experimental server for           |
  11975.      |                        16 colour graphics modes             |
  11976.      |xf86-svr-2.0.tar.gz     All of the above servers             |
  11977.      |xf86-bin-2.0.tar.gz     Client programs (required)           |
  11978.      |xf86-lib-2.0.tar.gz     Dynamic libraries, bitmaps and       |
  11979.      |                        minimal fonts (required)             |
  11980.      |xf86-cfg-2.0.tar.gz     XDM configuration files and          |
  11981.      |                        chooser (optional)                   |
  11982.      |xf86-fnt-2.0.tar.gz     All of the fonts (optional,          |
  11983.      |                        but required for some applications)  |
  11984.      |xf86-kit-2.0.tar.gz     Linkkit for building your own        |
  11985.      |                        X servers (optional)                 |
  11986.      |xf86-man-2.0.tar.gz     Manual pages (both client +          |
  11987.      |                        programmer, optional)                |
  11988.      |xf86-pex-2.0.tar.gz     PEX libraries and sample             |
  11989.      |                        clients (optional)                   |
  11990.      |xf86-prg-2.0.tar.gz     Static libs, dynamic stubs, configs  |
  11991.      |                        and include files (optional)         |
  11992.      |xf86-doc-2.0.tar.gz     Documentation and release notes      |
  11993.      |                        for XFree86 2.0 (optional)           |
  11994.      |xf86-doc2-2.0.tar.gz    Extra documentation (optional)       |
  11995.      |                                                             |
  11996.      +-------------------------------------------------------------+
  11997.  
  11998.  
  11999.                                 - 184 -
  12000.  
  12001.  
  12002.  
  12003.  
  12004.  
  12005.  
  12006.  
  12007.  
  12008.  
  12009.           Installation  is covered in the XFree86-HOWTO; essentially you need
  12010.      to unpack the tar files (as root) from /.
  12011.  
  12012.  
  12013.           After installing the software, you may  need  to  link  the  shared
  12014.      libraries  from  /usr/X386/lib  to  /lib. One way to do this is with the
  12015.      command:
  12016.  
  12017.  
  12018.           # ln -s /usr/X386/lib/lib*.so.?  /lib
  12019.  
  12020.  
  12021.           You may wish to physically copy the files instead. This step may be
  12022.      unnecessary  with the newer XFree86 distributions; see the documentation
  12023.      provided in the release for more information.
  12024.  
  12025.  
  12026.           If you installed XFree86 from a standard Linux distribution such as
  12027.      SLS  or  Slackware, then all of the files should already be in the right
  12028.      place.
  12029.  
  12030.  
  12031.           If you wish to use the SVGA color server, the  file  /usr/bin/X11/X
  12032.      should  be  linked  to  /usr/bin/X11/XF86 SVGA.  If  you wish to use the
  12033.      monochrome server instead, relink this file to XF86 MONO with  the  com¡
  12034.      mand
  12035.  
  12036.  
  12037.           # ln -sf /usr/bin/X11/XF86 MONO  /usr/bin/X11/X
  12038.  
  12039.  
  12040.           The same holds true if you are using one of the other servers.
  12041.  
  12042.  
  12043.      6.1.4  Configuring XFree86
  12044.  
  12045.      Setting  up  XFree86  is not difficult in most cases. Only when you have
  12046.      non-standard hardware will XFree86 configuration give you any  problems.
  12047.      However,  XFree86  configuration  is  beyond the scope of this document;
  12048.      here, we'll give you a brief overview of how it works.
  12049.  
  12050.  
  12051.           A complete discussion of XFree86 configuration can be found in  the
  12052.      file    README.Config   included   with   XFree86-2.0   (in   the   file
  12053.      xf86-doc-2.0.tar.gz). Please read this file for complete information  on
  12054.      setting  up  the  system.  Furthermore,  you must read the man pages for
  12055.      Xconfig, XFree86, and the server  that  you  are  setting  up  (such  as
  12056.      XF86 SVGA).  These man pages describe all of the options that are avail¡
  12057.      able for the configuration files.
  12058.  
  12059.  
  12060.           The main XFree86 configuration file is /usr/lib/X11/Xconfig.   This
  12061.      file  contains  information on your mouse, video card parameters, and so
  12062.      on. The file Xconfig.sample is provided with the XFree86 distribution as
  12063.  
  12064.  
  12065.                                 - 185 -
  12066.  
  12067.  
  12068.  
  12069.  
  12070.  
  12071.  
  12072.  
  12073.  
  12074.  
  12075.      an  example.  The  XFree86  man page explains the format of this file in
  12076.      detail.
  12077.  
  12078.  
  12079.           In general, here's how it works. Your  video  card  is  capable  of
  12080.      driving  a  number  of ``dot clocks'' which are simply clock frequencies
  12081.      for your card. In turn, each dot clock has a resolution mode  associated
  12082.      with  it,  such as 640x480 or 1024x768. (You are not restrained to using
  12083.      ``standard'' resolutions, as we will see). In  the  Xconfig  file  there
  12084.      exists  stanzas  for configuring your mouse, keyboard, and so on.  There
  12085.      also exists stanzas for each server: vga256 for the color  SVGA  server,
  12086.      vga2 for the monochrome server, and so on.
  12087.  
  12088.  
  12089.           Under  each  server stanza are lines to set the virtual resolution,
  12090.      chipset type, and so on for you video card. There is also a  Modes  line
  12091.      which  specifies  which modes are available on your card. Modes are usu¡
  12092.      ally named after their resolution. For example,
  12093.  
  12094.  
  12095.           Modes "640x480" "800x600" "1024x768"
  12096.  
  12097.  
  12098.           Each mode on this line is an index into the modeDB  stanza  at  the
  12099.      end of the Xconfig file. It is this section of the file which determines
  12100.      the actual video parameters for each mode.
  12101.  
  12102.  
  12103.           There is also an optional Clocks line which you can use to set  the
  12104.      available  dot  clocks for your card. By default, XFree86 will determine
  12105.      the clocks at startup time; however, because clock timing can be  thrown
  12106.      off  by  other  programs running on your system, it may be easier to set
  12107.      the clocks in the Xconfig file.
  12108.  
  12109.  
  12110.           The modeDB section of the Xconfig file is the important part.  Each
  12111.      video  card  and  monitor has its own set of timing and sync frequencies
  12112.      for different resolutions. The file /usr/lib/X11/etc/modeDB.txt contains
  12113.      a  database  of  some known monitor and video card timing numbers.  Many
  12114.      card and monitors use the VESA standard timings included in  the  sample
  12115.      Xconfig file.
  12116.  
  12117.  
  12118.           There  are  various  other  documents in /usr/lib/X11/etc which you
  12119.      should read. The file VideoModes.txt is a tutorial on hacking  your  own
  12120.      monitor  frequency timings if you simply can't get any of the numbers in
  12121.      modeDB.txt to work. There is also a collection of sample  Xconfig  files
  12122.      on  sunsite.unc.edu in the file /pub/Linux/X11/Xconfig.tgz. Also see the
  12123.      XFree86 man pages for more information.
  12124.  
  12125.  
  12126.  <>       Be careful when setting up your Xconfig  file.   If  you  select  a
  12127.      clock  frequency higher than your monitor can support, you may very well
  12128.      damage the monitor. Check the  documentation  for  your  monitor  before
  12129.  
  12130.  
  12131.                                 - 186 -
  12132.  
  12133.  
  12134.  
  12135.  
  12136.  
  12137.  
  12138.  
  12139.  
  12140.  
  12141.      attempting to drive it at a high clock frequency.
  12142.  
  12143.  
  12144.           If  you  are not sure what kind of video hardware you have, you can
  12145.      run the program /usr/bin/X11/SuperProbe, which is fairly good at detect¡
  12146.      ing  video  hardware. However, SuperProbe is not always correct, so rely
  12147.      on your manuals and common sense before  trusting  it  completely.  Also
  12148.      note  that  SuperProbe  will  detect more hardware than XFree86-2.0 sup¡
  12149.      ports.
  12150.  
  12151.  
  12152.           Again, we refer you to the Linux XFree86-HOWTO for complete  infor¡
  12153.      mation on setting up this beast.
  12154.  
  12155.  
  12156.      6.1.5  Starting up X
  12157.  
  12158.      After  configuring  the  Xconfig file, you can start the server with the
  12159.      startx command. There are a few things to take into consideration first,
  12160.      however.
  12161.  
  12162.  
  12163.           Make  sure  that  the  directory /usr/bin/X11 is on your path. This
  12164.      directory contains all of the X binaries and the server itself.
  12165.  
  12166.  
  12167.           Secondly, the X server requires a free VC to enable VC switching(3)
  12168.      .  In other words, you must have one of your  VC's  available,  with  no
  12169.      login  process  running on it. The easiest way to ensure this is to edit
  12170.      /etc/inittab and delete one of the getty lines which starts up  a  login
  12171.      process on each VC. In my inittab, for example, I run getty on /dev/tty1
  12172.      through /dev/tty7 (that is, VC's 1 through 7), but not on /dev/tty8.
  12173.  
  12174.  
  12175.           When running startx, the file $HOME/.xinitrc is read.  This file is
  12176.      a  shell  script  which  contains  commands to run after the X server is
  12177.      started. If this file doesn't exist, the file /usr/lib/X11/xinit/xinitrc
  12178.      is  used as a system-wide default instead. You can use this default file
  12179.      as a sample .xinitrc file.
  12180.  
  12181.  
  12182.           Using X Windows is a large topic, and we  won't  try  to  cover  it
  12183.      here.   Read  The X Window System User's Guide, or another book on using
  12184.      X, for details. See Appendix A information on this book.
  12185.  
  12186.  
  12187.      6.1.6  Exiting X
  12188.  
  12189.      Usually, the last client started in .xinitrc is the one used to shutdown
  12190.  
  12191.      
  12192.  
  12193.      3. While  running  X,  you can switch back to your text VC's
  12194.         using the keys `ctrl-alt-F1' through  `ctrl-alt-F12'.  To
  12195.         return  to  X,  simply  switch  to  the  VC  reserved for
  12196.         XFree86.
  12197.  
  12198.                                 - 187 -
  12199.  
  12200.  
  12201.  
  12202.  
  12203.  
  12204.  
  12205.  
  12206.  
  12207.  
  12208.      X cleanly. For example, if the last command in .xinitrc is
  12209.  
  12210.  
  12211.           exec twm
  12212.  
  12213.  
  12214.           then killing the twm process will result in X shutting down.
  12215.  
  12216.  
  12217.           However, if you need to immediately kill the X server for some rea¡
  12218.      son, you can use the key combination `ctrl-alt-backspace'.
  12219.  
  12220.  
  12221.      6.1.7  Accessing MS-DOS Files
  12222.  
  12223.      If, for some twisted and bizarre reason, you would have need  to  access
  12224.      files from MS-DOS, it's quite easily done under Linux.
  12225.  
  12226.  
  12227.           The  usual  way to access MS-DOS files is to mount an MS-DOS parti¡
  12228.      tion or floppy under Linux, allowing you to access  the  files  directly
  12229.      through  the  filesystem.  For  example, if you have an MS-DOS floppy in
  12230.      /dev/fd0, the command
  12231.  
  12232.  
  12233.           # mount -t msdos /dev/fd0 /mnt
  12234.  
  12235.  
  12236.           will mount it under /mnt. See Section 5.6.2 for more information on     mounting floppies.
  12237.  
  12238.  
  12239.           You  can  also  mount  an  MS-DOS  partition of your hard drive for
  12240.      access under Linux. If you have an MS-DOS partition  on  /dev/hda1,  the
  12241.      command
  12242.  
  12243.  
  12244.           # mount -t msdos /dev/hda1 /mnt
  12245.  
  12246.  
  12247.           will  mount  it.  Be  sure to umount the partition when you're done
  12248.      using it. You can have your MS-DOS partitions automatically  mounted  at
  12249.      boot time if you include entries for them in /etc/fstab; see Section 5.8
  12250.      for details. For example, the following line in /etc/fstab will mount an
  12251.      MS-DOS partition on /dev/hda1 on the directory /dos.
  12252.  
  12253.  
  12254.           /dev/hda1     /dos     msdos      defaults
  12255.  
  12256.  
  12257.  
  12258.  
  12259.           The  Mtools  software may also be used to access MS-DOS files.  For
  12260.      example, the commands mcd, mdir, and mcopy all behave  as  their  MS-DOS
  12261.  
  12262.  
  12263.                                 - 188 -
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.      counterparts.  If you installed Mtools, there should be man pages avail¡
  12274.      able for these commands.
  12275.  
  12276.  
  12277.           Accessing MS-DOS files is one thing; running MS-DOS  programs  from
  12278.      Linux  is  another.  There  is  an MS-DOS Emulator under development for
  12279.      Linux; it is widely available, and even distributed with SLS. It can  be
  12280.      retrieved  from  a  number of locations, including the various Linux FTP
  12281.      sites (see Appendix C for details). The MS-DOS Emulator is  reportedly
  12282.      powerful  enough to run a number of applications, including Wordperfect,
  12283.      from Linux. However, Linux and MS-DOS  are  vastly  different  operating
  12284.      systems.  The  power  of any MS-DOS emulator under UNIX is somewhat lim¡
  12285.      ited.
  12286.  
  12287.  
  12288.           In addition, work is underway on a Microsoft  Windows  emulator  to
  12289.      run  under X Windows. Watch the newsgroups and FTP sites for more infor¡
  12290.      mation.
  12291.  
  12292.  
  12293.      6.2  Networking with TCP/IP
  12294.  
  12295.      Linux supports a full implementation of the  TCP/IP  (Transport  Control
  12296.      Protocol/Internet  Protocol) networking protocols. TCP/IP has become the
  12297.      most successful mechanism  for  networking  computers  worldwide.   With
  12298.      Linux and an Ethernet card, you can network your machine to a local area
  12299.      network, or (with the proper network connections), to the Internet---the
  12300.      worldwide TCP/IP network.
  12301.  
  12302.  
  12303.           Hooking up a small LAN of UNIX machines is easy. It simply requires
  12304.      an Ethernet controller in each  machine  and  the  appropriate  Ethernet
  12305.      cables  and  other hardware. Or, if your business or university provides
  12306.      access to the Internet, you can easily add your Linux  machine  to  this
  12307.      network.
  12308.  
  12309.  
  12310.           Linux  TCP/IP  also  supports SLIP---Serial Line Internet Protocol.
  12311.      SLIP allows you to have dialup Internet access using a modem.   If  your
  12312.      business or university provides SLIP access, you can dial in to the SLIP
  12313.      server and put your machine on the Internet over the phone line.  Alter¡
  12314.      nately,  if your Linux machine also has Ethernet access to the Internet,
  12315.      you can set up your Linux box as a SLIP server.
  12316.  
  12317.  
  12318.           For complete information on  setting  up  TCP/IP  under  Linux,  we
  12319.      encourage you to read the Linux NET-2 HOWTO, available via anonymous FTP
  12320.      from sunsite.unc.edu. The NET-2 HOWTO is a complete guide to configuring
  12321.      TCP/IP, including Ethernet and SLIP connections, under Linux.  The Linux
  12322.      Ethernet HOWTO is a related document  that  describes  configuration  of
  12323.      various  Ethernet card drivers for Linux.  The Linux Network Administra¡
  12324.      tor's Guide, from the Linux Documentation Project,  is  also  available.
  12325.      See Appendix A for more information on these documents.
  12326.  
  12327.  
  12328.  
  12329.                                 - 189 -
  12330.  
  12331.  
  12332.  
  12333.  
  12334.  
  12335.  
  12336.  
  12337.  
  12338.  
  12339.           Also  of  interest  is  the  book TCP/IP Network Administration, by
  12340.      Craig Hunt. It contains complete information on  using  and  configuring
  12341.      TCP/IP on UNIX systems.
  12342.  
  12343.  
  12344.      6.2.1  Hardware Requirements
  12345.  
  12346.      You   can   use   Linux   TCP/IP  without  any  networking  hardware  at
  12347.      all---configuring ``loopback'' mode allows you to talk to yourself. This
  12348.      is  necessary for some applications and games which use the ``loopback''
  12349.      network device.
  12350.  
  12351.  
  12352.           However, if you want to use Linux with an Ethernet TCP/IP  network,
  12353.      you need one of the following Ethernet cards: 3com 3c503, 3c503/16; Nov¡
  12354.      ell NE1000, NE2000; Western  Digital  WD8003,  WD8013;  Hewlett  Packard
  12355.      HP27245, HP27247, HP27250.
  12356.  
  12357.  
  12358.           The  following  clones are reported to work: WD-80x3 clones: LANNET
  12359.      LEC-45; NE2000 clones:  Alta  Combo,  Artisoft  LANtastic  AE-2,  Asante
  12360.      Etherpak  2001/2003,  D-Link Ethernet II, LTC E-NET/16 P/N 8300-200-002,
  12361.      Network Solutions HE-203, SVEC 4 Dimension Ethernet, 4-Dimension  FD0490
  12362.      EtherBoard 16, and D-Link DE-600, SMC Elite 16.
  12363.  
  12364.  
  12365.           See  the  Linux  Ethernet  HOWTO  for a more complete discussion of
  12366.      Linux Ethernet hardware compatibility.
  12367.  
  12368.  
  12369.           Linux also supports SLIP, which allows you to use a modem to access
  12370.      the Internet over the phone line. In this case, you'll need a modem com¡
  12371.      patible with your SLIP server---most servers require a  14.4bps  V.32bis
  12372.      modem.  The NET-2 HOWTO includes complete information on SLIP configura¡
  12373.      tion.
  12374.  
  12375.  
  12376.      6.3  Networking with UUCP
  12377.  
  12378.      UUCP (UNIX-to-UNIX Copy) is an older mechanism used to transfer informa¡
  12379.      tion  between  UNIX systems. Using UUCP, UNIX systems dial each other up
  12380.      (using a modem) and transfer mail messages, news articles, files, and so
  12381.      on.  If you don't have TCP/IP or SLIP access, you can use UUCP to commu¡
  12382.      nicate with the world. Most of the mail and news software (see  Sections
  12383.      6.4  and  6.5)  can be configured to use UUCP to transfer information to
  12384.      other machines. In fact, if there is an Internet site  nearby,  you  can
  12385.      arrange  to  have Internet mail sent to your Linux machine via UUCP from
  12386.      that site.
  12387.  
  12388.  
  12389.           The Linux Network Administrator's Guide contains complete  informa¡
  12390.      tion  on  configuring  and  using UUCP under Linux. Also, the Linux UUCP
  12391.      HOWTO, available via anonymous FTP from sunsite.unc.edu,  should  be  of
  12392.      help.  Another  source  of information on UUCP is the book Managing UUCP
  12393.  
  12394.  
  12395.                                 - 190 -
  12396.  
  12397.  
  12398.  
  12399.  
  12400.  
  12401.  
  12402.  
  12403.  
  12404.  
  12405.      and USENET, by Tim O'Reilly and Grace Todino. See Appendix A for  more
  12406.      information.
  12407.  
  12408.  
  12409.      6.4  Electronic Mail
  12410.  
  12411.      Like most UNIX systems, Linux provides a number of software packages for
  12412.      using electronic mail. E-mail on your system can either be  local  (that
  12413.      is,  you  only  mail other users on your system), or networked (that is,
  12414.      you mail, using either TCP/IP or UUCP, users on other machines on a net¡
  12415.      work).   E-mail  software  usually consists of two parts: a mailer and a
  12416.      transport. The mailer is the user-level software which is used to  actu¡
  12417.      ally  compose  and read e-mail messages. Popular mailers include elm and
  12418.      mailx. The transport is the low-level software which actually takes care
  12419.      of delivering the mail, either locally or remotely.  The user never sees
  12420.      the transport software; they only interact with the mailer. However,  as
  12421.      the  system  administrator,  it  is important to understand the concepts
  12422.      behind the transport software and how to configure it.
  12423.  
  12424.  
  12425.           The most popular transport software for Linux is Smail. This  soft¡
  12426.      ware  is  easy  to  configure, and is able to send both local and remote
  12427.      TCP/IP e-mail. The more powerful sendmail transport is used on most UNIX
  12428.      systems, however, because of its complicated setup mechanism, most Linux
  12429.      systems don't use it.
  12430.  
  12431.  
  12432.           The Linux Mail HOWTO gives more information on the  available  mail
  12433.      software  for  Linux and how to configure it on your system. If you plan
  12434.      to send mail remotely, you'll need to understand either TCP/IP or  UUCP,
  12435.      depending  on  how your machine is networked (see Sections 6.2 and 6.3).
  12436.      The UUCP and TCP/IP documents listed in Appendix A should be  of  help
  12437.      there.
  12438.  
  12439.  
  12440.           Most  of the Linux mail software can be retrieved via anonymous FTP
  12441.      from sunsite.unc.edu in the directory /pub/Linux/system/Mail.
  12442.  
  12443.  
  12444.      6.5  News and USENET
  12445.  
  12446.      Linux also provides a number of facilities for managing electronic news.
  12447.      You  may choose to set up a local news server on your system, which will
  12448.      allow users to post ``articles'' to various ``newsgroups'' on  the  sys¡
  12449.      tem...a  lively  form  of  discussion.  However, if you have access to a
  12450.      TCP/IP or UUCP  network,  then  you  will  be  able  to  participate  in
  12451.      USENET---a worldwide network news service.
  12452.  
  12453.  
  12454.           There  are  two  parts  to  the  news software---the server and the
  12455.      client. The news server is the software which  controls  the  newsgroups
  12456.      and  handles delivering articles to other machines (if you are on a net¡
  12457.      work).  The news client, or newsreader, is the software  which  connects
  12458.      to the server to allow users to read and post news.
  12459.  
  12460.  
  12461.                                 - 191 -
  12462.  
  12463.  
  12464.  
  12465.  
  12466.  
  12467.  
  12468.  
  12469.  
  12470.  
  12471.           There  are  several forms of news servers available for Linux. They
  12472.      all follow the same basic protocols and design. The two primary versions
  12473.      are  ``C  News''  and  ``INN''.  There are many types of newsreaders, as
  12474.      well, such as rn and tin. The choice of newsreader is  more  or  less  a
  12475.      matter of taste; all newsreaders should work equally well with different
  12476.      versions of the server software. That is, the newsreader is  independent
  12477.      of the server software, and vice versa.
  12478.  
  12479.  
  12480.           If  you  only  want  to  run  news locally (that is, not as part of
  12481.      USENET), then you will need to run a server on your system, as  well  as
  12482.      install a newsreader for the users. The news server will store the arti¡
  12483.      cles in a directory such as /usr/spool/news, and the newsreader will  be
  12484.      compiled to look in this directory for news articles.
  12485.  
  12486.  
  12487.           However,  if  you wish to run news over the network, there are sev¡
  12488.      eral options open to you. TCP/IP  network-based  news  uses  a  protocol
  12489.      known  as NNTP (Network News Transmission Protocol). NNTP allows a news¡
  12490.      reader to read news over the network, on a  remote  machine.  NNTP  also
  12491.      allows  news  servers  to  send  articles  to  each  other over the net¡
  12492.      work---this is the software upon which USENET is based. Most  businesses
  12493.      and  universities  have one or more NNTP servers set up to handle all of
  12494.      the USENET news for that site.  Every other machine at the site runs  an
  12495.      NNTP-based  newsreader  to  read  and post news over the network via the
  12496.      NNTP server. This means that only the NNTP server  actually  stores  the
  12497.      news articles on disk.
  12498.  
  12499.  
  12500.           Here are some possible scenarios for news configuration.
  12501.  
  12502.  
  12503.              * You run news locally. That is, you have no network connection,
  12504.                or no desire to run news over the network. In this  case,  you
  12505.                need to run C News or INN on your machine, and install a news¡
  12506.                reader to read the news locally.
  12507.  
  12508.  
  12509.              * You have access to a TCP/IP network and an  NNTP  server.   If
  12510.                your organization has an NNTP news server set up, you can read
  12511.                and post news from your Linux machine by simply installing  an
  12512.                NNTP-based newsreader. (Most newsreaders available can be con¡
  12513.                figured to run locally or use NNTP). In this case, you do  not
  12514.                need  to  install a news server or store news articles on your
  12515.                system. The newsreader will take care of reading  and  posting
  12516.                news over the network. Of course, you will need to have TCP/IP
  12517.                configured and have access to the network (see Section 6.2).
  12518.  
  12519.  
  12520.              * You have access to a TCP/IP network but have no  NNTP  server.
  12521.                In  this  case,  you can run an NNTP news server on your Linux
  12522.                system.  You can install either a local or an NNTP-based news¡
  12523.                reader,  and  the server will store news articles on your sys¡
  12524.                tem. In addition, you can configure the server to  communicate
  12525.  
  12526.  
  12527.                                 - 192 -
  12528.  
  12529.  
  12530.  
  12531.  
  12532.  
  12533.  
  12534.  
  12535.  
  12536.  
  12537.                with other NNTP news servers to transfer news articles.
  12538.  
  12539.  
  12540.              * You  want to transfer news using UUCP. If you have UUCP access
  12541.                (see Section 6.3), you can participate in USENET as well.  You
  12542.                will  need to install a (local) news server and a news reader.
  12543.                In addition, you will need to configure your UUCP software  to
  12544.                periodically  transfer  news  articles  to another nearby UUCP
  12545.                machine (known as your ``news feed''). UUCP does not use  NNTP
  12546.                to  transfer news; simply, UUCP provides its own mechanism for
  12547.                transferring news articles.
  12548.  
  12549.  
  12550.  
  12551.  
  12552.  
  12553.           The one downside of most news server  and  newsreader  software  is
  12554.      that it must be compiled by hand. Most of the news software does not use
  12555.      configuration files; instead, configuration options  are  determined  at
  12556.      compile time.
  12557.  
  12558.  
  12559.           Most of the ``standard'' news software (available via anonymous FTP
  12560.      from ftp.uu.net in the directory /news) will compile out-of-the  box  on
  12561.      Linux.   Necessary   patches   can   be   found  on  sunsite.unc.edu  in
  12562.      /pub/Linux/system/Mail (which is, incidentally, also where mail software
  12563.      for  Linux is found). Other news binaries for Linux may be found in this
  12564.      directory as well.
  12565.  
  12566.  
  12567.           For more information, refer to  the  Linux  News  HOWTO  from  sun¡
  12568.      site.unc.edu  in  /pub/Linux/docs/HOWTO.  Also,  the LDP's Linux Network
  12569.      Administrator's Guide contains complete information on configuring  news
  12570.      software  for  Linux. The book Managing UUCP and Usenet, by Tim O'Reilly
  12571.      and Grace Todino, is an excellent guide to  setting  up  UUCP  and  news
  12572.      software.  Also  of  interest  is  the USENET document ``How to become a
  12573.      USENET   site,''   available   from   ftp.uu.net,   in   the   directory
  12574.      /usenet/news.announce.newusers.
  12575.  
  12576.  
  12577.  
  12578.  
  12579.  
  12580.  
  12581.  
  12582.  
  12583.  
  12584.  
  12585.  
  12586.  
  12587.  
  12588.  
  12589.  
  12590.  
  12591.  
  12592.  
  12593.                                 - 193 -
  12594.  
  12595.  
  12596.  
  12597.  
  12598.  
  12599.  
  12600.  
  12601.  
  12602.  
  12603.                                       APPENDIX A
  12604.  
  12605.  
  12606.                            Sources of Linux Information
  12607.  
  12608.  
  12609.  
  12610.  
  12611.           This  appendix  contains  information  on  various sources of Linux
  12612.      information, such as online documents, books, and more.  Many  of  these
  12613.      documents  are  available either in printed form, or electronically from
  12614.      the Internet or BBS systems. Many Linux distributions also include  much
  12615.      of  this  documentation  in  the  distribution itself, so after you have
  12616.      installed Linux these files may be present on your system.
  12617.  
  12618.  
  12619.      A.1  Online Documents
  12620.  
  12621.      These documents should be available on any  of  the  Linux  FTP  archive
  12622.      sites (see Appendix C for a list). If you do not have direct access to
  12623.      FTP, you may be able to locate these documents on other online  services
  12624.      (such  as  CompuServe,  local  BBS's,  and so on). If you have access to
  12625.      Internet mail, you can use the ftpmail service to receive  these  docuc¡
  12626.      ments. See Appendix C for more information.
  12627.  
  12628.  
  12629.           In  particular,  the  following  documents  may  be  found  on sun¡
  12630.      site.unc.edu in the directory /pub/Linux/docs. Many  sites  mirror  this
  12631.      directory;  however,  if you're unable to locate a mirror site near you,
  12632.      this is a good one to fall back on.
  12633.  
  12634.  
  12635.           You can also access Linux files  and  documentation  using  gopher.
  12636.      Just  point your gopher client to port 70 on sunsite.unc.edu, and follow
  12637.      the menus to the Linux archive. This is a good way to browse Linux docu¡
  12638.      mentation interactively.
  12639.  
  12640.  
  12641.  
  12642.  
  12643.  
  12644.              * The Linux Frequently Asked Questions List. The Linux Frequently
  12645.                Asked Questions list, or ``FAQ'', is a list  of  common  ques¡
  12646.                tions  (and  answers!)  about Linux. This document is meant to
  12647.                provide a general source of information  about  Linux,  common
  12648.                problems  and solutions, and a list of other sources of infor¡
  12649.                mation. Every new Linux user should read this document. It  is
  12650.                available  in  a  number  of  formats,  including plain ASCII,
  12651.                PostScript, and Lout typesetter format. The Linux FAQ is main¡
  12652.                tained by Ian Jackson, ijackson@nyx.cs.du.edu.
  12653.  
  12654.  
  12655.              * The Linux META-FAQ. The META-FAQ is a collection of ``metaques¡
  12656.                tions'' about Linux; that is, sources of information about the
  12657.  
  12658.  
  12659.                                 - 194 -
  12660.  
  12661.  
  12662.  
  12663.  
  12664.  
  12665.  
  12666.  
  12667.  
  12668.  
  12669.                Linux system, and other general topics.  It is a good starting
  12670.                place for the Internet user wishing to find  more  information
  12671.                about  the  system.  It  is  maintained by Michael K. Johnson,
  12672.                johnsonm@sunsite.unc.edu.
  12673.  
  12674.  
  12675.              * The Linux INFO-SHEET.  The  Linux  INFO-SHEET  is  a  technical
  12676.                introduction  to the Linux system. It gives an overview of the
  12677.                system's features and available software, and also provides  a
  12678.                list  of  other  sources  of Linux information. The format and
  12679.                content is similar in nature to the META-FAQ; incidentally, it
  12680.                is also maintained by Michael K. Johnson.
  12681.  
  12682.  
  12683.              * The  Linux  Software  Map.  The Linux Software Map is a list of
  12684.                many applications available for Linux, where to get them,  who
  12685.                maintains  them,  and  so  forth. It is far from complete---to
  12686.                compile a complete list of  Linux  software  would  be  nearly
  12687.                impossible.  However, it does include many of the most popular
  12688.                Linux software packages. If you can't find a particular appli¡
  12689.                cation  to  cuit your needs, the LSM is a good place to start.
  12690.                It is maintained by Jeff Kopmanis, jeffk@msen.com.
  12691.  
  12692.  
  12693.              * The Linux HOWTO Index. The Linux HOWTOs  are  a  collection  of
  12694.                ``how  to''  documents,  each  describing  in detail a certain
  12695.                aspect of the Linux system. They are maintained by Matt Welsh,
  12696.                mdw@sunsite.unc.edu. The HOWTO Index lists the HOWTO documents
  12697.                which are available (several of which are listed below).
  12698.  
  12699.  
  12700.              * The Linux Installation  HOWTO.  The  Linux  Installation  HOWTO
  12701.                describes  how  to obtain and install a distribution of Linux,
  12702.                similar to the information presented in Chapter 3..
  12703.  
  12704.  
  12705.              * The Linux Distribution HOWTO. This document is a list of  Linux
  12706.                distributions  available  via mail order and anonymous FTP. It
  12707.                also includes information on other Linux-related  goodies  and
  12708.                services.  Appendix  B is a condensed version of the list in
  12709.                the Distribution HOWTO.
  12710.  
  12711.  
  12712.              * The Linux XFree86 HOWTO. This document describes how to install
  12713.                and  configure the X Window System software for Linux. See 
  12714.                Section 6.1 for more about the X Window System.
  12715.  
  12716.  
  12717.              * The Linux Mail, News, and UUCP HOWTOs. These three HOWTO  docu¡
  12718.                ments  describe  configuration  and  setup of electronic mail,
  12719.                news, and UUCP communications on a Linux system. Because these
  12720.                three subjects are often intertwined, you may wish to read all
  12721.                three of these HOWTOs together.
  12722.  
  12723.  
  12724.  
  12725.                                 - 195 -
  12726.  
  12727.  
  12728.  
  12729.  
  12730.  
  12731.  
  12732.  
  12733.  
  12734.  
  12735.              * The Linux Hardware HOWTO. This HOWTO contains an extensive list
  12736.                of  hardware  supported by Linux.  While this list is far from
  12737.                complete, it should give you a general picture of which  hard¡
  12738.                ware devices should be supported by the system.
  12739.  
  12740.  
  12741.              * The  Linux SCSI HOWTO. The Linux SCSI HOWTO is a complete guide
  12742.                to configuration and usage of SCSI devices under  Linux,  such
  12743.                as hard drives, tape drives and CD-ROM.
  12744.  
  12745.  
  12746.              * The  Linux NET-2-HOWTO. The Linux NET-2-HOWTO describes instal¡
  12747.                lation, setup, and configuration of the ``NET-2'' TCP/IP soft¡
  12748.                ware under Linux, including SLIP. If you want to use TCP/IP on
  12749.                your Linux system, this document is a must read.
  12750.  
  12751.  
  12752.              * The Linux Ethernet HOWTO. Closely related to  the  NET-2-HOWTO,
  12753.                the Ethernet HOWTO describes the various Ethernet devices sup¡
  12754.                ported by Linux, and explains how to configure  each  of  them
  12755.                for use by the Linux TCP/IP software.
  12756.  
  12757.  
  12758.              * The  Linux  Printing HOWTO. This document describes how to con¡
  12759.                figure printing software under Linux, such as lpr.  Configura¡
  12760.                tion  of printers and printing software under UNIX can be very
  12761.                confusing at times; this document sheds some light on the sub¡
  12762.                ject.
  12763.  
  12764.  
  12765.              * Other  online documents:If you browse the docs subdirectory of
  12766.                any Linux FTP site, you'll see many other documents which  are
  12767.                not  listed  here:  A  slew of FAQ's, interesting tidbits, and
  12768.                other important information. This miscellany is  difficult  to
  12769.                categorize  here;  if you don't see what you're looking for on
  12770.                the list above, just take a look at one of the  Linux  archive
  12771.                sites listed in Appendix C.
  12772.  
  12773.  
  12774.  
  12775.  
  12776.  
  12777.      A.2  Linux Documentation Project Manuals
  12778.  
  12779.      The  Linux Documentation Project is working on developing a set of manu¡
  12780.      als and other documentation for Linux, including man pages. These  manu¡
  12781.      als  are  in  various  stages  of development, and any help revising and
  12782.      updating them is greatly appreciated. If you have  questions  about  the
  12783.      LDP, please contact Matt Welsh (mdw@sunsite.unc.edu).
  12784.  
  12785.  
  12786.           These  books are available via anonymous FTP from a number of Linux
  12787.      archive   sites,   including   sunsite.unc.edu    in    the    directory
  12788.      /pub/Linux/docs/LDP.  A  number  of  commercial distributors are selling
  12789.  
  12790.  
  12791.                                 - 196 -
  12792.  
  12793.  
  12794.  
  12795.  
  12796.  
  12797.  
  12798.  
  12799.  
  12800.  
  12801.      printed copies of these books; in the future, you may be  able  to  find
  12802.      the LDP manuals on the shelves of your local bookstore.
  12803.  
  12804.  
  12805.  
  12806.  
  12807.  
  12808.              * Linux  Installation  and  Getting Started, by Matt Welsh. A new
  12809.                user's guide for Linux, covering everything the new user needs
  12810.                to know to get started. Linux Installation and Getting Started
  12811.                is targeted primarily for the UNIX novice, and  as  such  does
  12812.                not  contain  the  broad  scope of information that is in this
  12813.                book. If you are new to UNIX and need more information,  Linux
  12814.                Installation and Getting Started is a great place to look.
  12815.  
  12816.  
  12817.              * The Linux System Administrators' Guide, by Lars Wirzenius. This
  12818.                is a complete guide to running and configuring a Linux system.
  12819.                There are many issues relating to systems administration which
  12820.                are specific to Linux, such as needs  for  supporting  a  user
  12821.                community,  filesystem  maintenance,  backups,  and more. This
  12822.                guide covers them all.
  12823.  
  12824.  
  12825.              * The Linux Network Administrators'  Guide,  by Olaf  Kirch.  An
  12826.                extensive  and  complete  guide  to  networking  under  Linux,
  12827.                including TCP/IP, UUCP, SLIP, and more. This book  is  a  very
  12828.                good  read;  it  contains a wealth of information on many sub¡
  12829.                jects, clarifying the many confusing aspects of  network  con¡
  12830.                figuration.
  12831.  
  12832.  
  12833.              * The Linux Kernel Hackers' Guide, by Michael Johnson. The gritty
  12834.                details of kernel hacking and development under  Linux.  Linux
  12835.                is  unique  in  that  the complete kernel source is available.
  12836.                This book opens the doors to developers who  wish  to  add  or
  12837.                modify  features  within  the kernel. This guide also contains
  12838.                comprehensive coverage of kernel concepts and conventions used
  12839.                by Linux.
  12840.  
  12841.  
  12842.  
  12843.  
  12844.  
  12845.      A.3  Books and Other Published Works
  12846.  
  12847.      As  we  have said, not many books have been published dealing with Linux
  12848.      specifically. However, if you are new to the world of UNIX, or want more
  12849.      information  than  is presented here, we suggest that you take a look at
  12850.      the following books which are available.
  12851.  
  12852.  
  12853.  
  12854.  
  12855.  
  12856.  
  12857.                                 - 197 -
  12858.  
  12859.  
  12860.  
  12861.  
  12862.  
  12863.  
  12864.  
  12865.  
  12866.  
  12867.         Title:  Learning the UNIX Operating System
  12868.  
  12869.        Author:  Grace Todino & John Strang
  12870.  
  12871.      Publisher:  O'Reilly and Associates, 1987
  12872.  
  12873.          ISBN:  0-937175-16-1
  12874.  
  12875.      Appr. Price:  $9.00
  12876.  
  12877.           A good introductory book on learning the  UNIX  operating
  12878.           system.  Most  of the information should be applicable to
  12879.           Linux as well. I suggest reading this book if you're  new
  12880.           to  UNIX  and  really want to get started with using your
  12881.           new system.
  12882.  
  12883.  
  12884.  
  12885.  
  12886.  
  12887.         Title:  Learning the vi Editor
  12888.  
  12889.        Author:  Linda Lamb
  12890.  
  12891.      Publisher:  O'Reilly and Associates, 1990
  12892.  
  12893.          ISBN:  0-937175-67-6
  12894.  
  12895.      Appr. Price:  $21.95
  12896.  
  12897.           This is a book about the vi editor, a powerful text  edi¡
  12898.           tor  found  on every UNIX system in the world. It's often
  12899.           important to know and be able  to  use  vi,  because  you
  12900.           won't  always  have  access  to a ``real'' editor such as
  12901.           Emacs.
  12902.  
  12903.  
  12904.  
  12905.  
  12906.  
  12907.         Title:  Essential System Administration
  12908.  
  12909.        Author:  AEleen Frisch
  12910.  
  12911.      Publisher:  O'Reilly and Associates, 1991
  12912.  
  12913.          ISBN:  0-937175-80-3
  12914.  
  12915.      Appr. Price:  $29.95
  12916.  
  12917.  
  12918.  
  12919.  
  12920.  
  12921.  
  12922.  
  12923.                                 - 198 -
  12924.  
  12925.  
  12926.  
  12927.  
  12928.  
  12929.  
  12930.  
  12931.  
  12932.  
  12933.           From the O'Reilly  and  Associates  Catalog,  ``Like  any
  12934.           other  multi-user  system,  UNIX  requires  some care and
  12935.           feeding.  Essential System Administration tells you  how.
  12936.           This  book strips away the myth and confusion surrounding
  12937.           this important topic and provides a  compact,  manageable
  12938.           introduction to the tasks faced by anyone responsible for
  12939.           a UNIX system.'' I couldn't have said it better myself.
  12940.  
  12941.  
  12942.  
  12943.  
  12944.  
  12945.         Title:  TCP/IP Network Administration
  12946.  
  12947.        Author:  Craig Hunt
  12948.  
  12949.      Publisher:  O'Reilly and Associates, 1990
  12950.  
  12951.          ISBN:  0-937175-82-X
  12952.  
  12953.      Appr. Price:  $24.95
  12954.  
  12955.           A complete guide to setting up and running a TCP/IP  net¡
  12956.           work.  While this book is not Linux-specific, roughly 90%
  12957.           of it is applicable to Linux.   Coupled  with  the  Linux
  12958.           NET-2-HOWTO and Linux Network Administrator's Guide, this
  12959.           is a great book discussing  the  concepts  and  technical
  12960.           details of managing TCP/IP.
  12961.  
  12962.  
  12963.  
  12964.  
  12965.  
  12966.         Title:  Managing UUCP and Usenet
  12967.  
  12968.        Author:  Tim O'Reilly and Grace Todino
  12969.  
  12970.      Publisher:  O'Reilly and Associates, 1991
  12971.  
  12972.          ISBN:  0-937175-93-5
  12973.  
  12974.      Appr. Price:  $24.95
  12975.  
  12976.           This  book  covers how to install and configure UUCP net¡
  12977.           working  software,  including  configuration  for  USENET
  12978.           news.  If  you're  at  all  interested  in  using UUCP or
  12979.           accessing USENET news on your  system,  this  book  is  a
  12980.           must-read.
  12981.  
  12982.  
  12983.  
  12984.  
  12985.  
  12986.  
  12987.  
  12988.  
  12989.                                 - 199 -
  12990.  
  12991.  
  12992.  
  12993.  
  12994.  
  12995.  
  12996.  
  12997.  
  12998.  
  12999.         Title:  Practical UNIX Security
  13000.  
  13001.        Author:  Simson Garfinkel & Gene Spafford
  13002.  
  13003.      Publisher:  O'Reilly and Associates, 1991
  13004.  
  13005.          ISBN:  0-937175-72-2
  13006.  
  13007.      Appr. Price:  $29.95
  13008.  
  13009.           This  is  an  excellent  book on UNIX system security. It
  13010.           taught me quite a few things that  I  didn't  know,  even
  13011.           with  several years of UNIX system administration experi¡
  13012.           ence. As most UNIX books, this book is geared  for  large
  13013.           systems,  but  almost  all  of the content is relevant to
  13014.           Linux.
  13015.  
  13016.  
  13017.  
  13018.  
  13019.  
  13020.         Title:  X Window System User's Guide
  13021.  
  13022.        Author:  Valerie Quercia & Tim O'Reilly
  13023.  
  13024.      Publisher:  O'Reilly and Associates, 1993
  13025.  
  13026.          ISBN:  1-56592-014-7
  13027.  
  13028.      Appr. Price:  $34.95
  13029.  
  13030.           A complete tutorial and reference guide to  using  the  X
  13031.           Window  System.  If you installed X windows on your Linux
  13032.           system, and want to know how to get the most out  of  it,
  13033.           you should read this book. Unlike some windowing systems,
  13034.           a lot of the power provided by X is not obvious as  first
  13035.           sight.  After using X Windows for several years I learned
  13036.           some things by reading through this book.
  13037.  
  13038.  
  13039.  
  13040.  
  13041.  
  13042.         Title:  Using C on the UNIX System
  13043.  
  13044.        Author:  Dave Curry
  13045.  
  13046.      Publisher:  O'Reilly and Associates, 1989
  13047.  
  13048.          ISBN:  0-937175-23-4
  13049.  
  13050.      Appr. Price:  $24.95
  13051.  
  13052.  
  13053.  
  13054.  
  13055.                                 - 200 -
  13056.  
  13057.  
  13058.  
  13059.  
  13060.  
  13061.  
  13062.  
  13063.  
  13064.  
  13065.           This book will introduce you to all  of  the  aspects  of
  13066.           programming  on  the  UNIX  system  call level. It covers
  13067.           everything from files to terminal I/O to TCP/IP  sockets.
  13068.           If you want to develop software for Linux, this book is a
  13069.           must read.
  13070.  
  13071.  
  13072.  
  13073.  
  13074.  
  13075.  
  13076.  
  13077.  
  13078.  
  13079.  
  13080.  
  13081.  
  13082.  
  13083.  
  13084.  
  13085.  
  13086.  
  13087.  
  13088.  
  13089.  
  13090.  
  13091.  
  13092.  
  13093.  
  13094.  
  13095.  
  13096.  
  13097.  
  13098.  
  13099.  
  13100.  
  13101.  
  13102.  
  13103.  
  13104.  
  13105.  
  13106.  
  13107.  
  13108.  
  13109.  
  13110.  
  13111.  
  13112.  
  13113.  
  13114.  
  13115.  
  13116.  
  13117.  
  13118.  
  13119.  
  13120.  
  13121.                                 - 201 -
  13122.  
  13123.  
  13124.  
  13125.  
  13126.  
  13127.  
  13128.  
  13129.  
  13130.  
  13131.                                       APPENDIX B
  13132.  
  13133.  
  13134.                       Linux Distribution and Mail Order List
  13135.  
  13136.  
  13137.  
  13138.  
  13139.           This appendix lists a number of the distributions  of  Linux  which
  13140.      are available via anonymous FTP, from BBS systems, and via mail order.
  13141.  
  13142.  
  13143.           This  appendix  is  far  from complete; here, we only list the most
  13144.      popular releases of Linux. A more extensive list  of  distributions  and
  13145.      services is available from sunsite.unc.edu in
  13146.  
  13147.  
  13148.           /pub/Linux/docs/HOWTO/Distribution-HOWTO
  13149.  
  13150.  
  13151.           In  fact,  if  you're looking for a more up-to-date version of this
  13152.      list, you should look there. I admit that several popular  distributions
  13153.      are  missing  from  this  appendix.  In the future this appendix will be
  13154.      expanded to include all of the information from the  Distribution-HOWTO.
  13155.  
  13156.  
  13157.           In  each of the following entries, my own comments (in italics) are
  13158.      followed by the information from the distributors  themselves.  You  may
  13159.      safely disregard anything I say.
  13160.  
  13161.  
  13162.      B.1  MCC Interim Linux
  13163.  
  13164.      The MCC-Interim Linux distribution is one of the ``oldies but goodies''.
  13165.      it has been around for some time, and my own Linux system was originally
  13166.      installed  with  MCC-Interim  back  in the 0.95/0.96 days.  It is a very
  13167.      complete Linux system, and users rave about it. It has an easy installa¡
  13168.      tion  mechanism and is very solid. New users will have very little trou¡
  13169.      ble using MCC-Interim. The one thing that it doesn't include is  X  Win¡
  13170.      dows,  however,  X is very easy to install on top of it. It also doesn't
  13171.      include a lot of other large packages like TeX; but again, those  things
  13172.      are  simple  to  install.  MCC's real benefit is that it is a very solid
  13173.      base to start with; you are free to install other software on  your  own
  13174.      as needed.
  13175.  
  13176.  
  13177.  
  13178.  
  13179.  
  13180.              * Distributor: Dr. A. V. Le Blanc, LeBlanc@mcc.ac.uk, Manchester
  13181.                Computing Centre, University  of  Manchester,  Manchester  M13
  13182.                9PL, England, +44 61 275 6035.
  13183.  
  13184.  
  13185.  
  13186.  
  13187.                                 - 202 -
  13188.  
  13189.  
  13190.  
  13191.  
  13192.  
  13193.  
  13194.  
  13195.  
  13196.  
  13197.              * Description:  Base  Linux  installation.  Complete sources and
  13198.                patches for all included software are available. Full  details
  13199.                vary from release to release; see
  13200.  
  13201.  
  13202.                     /pub/linux/mcc-interim/.../Acknowledgements
  13203.  
  13204.  
  13205.                     at  ftp.mcc.ac.uk.   Roughly:  this  includes  the kernel
  13206.                (with source), C, C++, groff, man pages, basic utilities, net¡
  13207.                working.  The binaries fit on 6 or 7 floppies. It is also pos¡
  13208.                sible to have them on a DOS or Linux partition on a hard drive
  13209.                (plus  one  floppy) or on an NFS-mountable partition (plus two
  13210.                floppies).   New  versions  appear  at  2-3  month  intervals,
  13211.                depending on various factors.
  13212.  
  13213.  
  13214.              * Availability: By anonymous ftp from ftp.mcc.ac.uk in
  13215.  
  13216.  
  13217.                     /pub/linux/mcc-interim
  13218.  
  13219.  
  13220.                     Mirrored  at tsx-11.mit.edu, nic.funet.fi, and elsewhere.
  13221.  
  13222.  
  13223.  
  13224.  
  13225.  
  13226.      B.2  TAMU Linux Distribution
  13227.  
  13228.      TAMU is a very complete distribution of Linux  including  more  or  less
  13229.      everything, including X. One of its great benefits is that it has a sim¡
  13230.      ple and complete X installation procedure. Users that I have  spoken  to
  13231.      about TAMU have spoken well.
  13232.  
  13233.  
  13234.  
  13235.  
  13236.  
  13237.              * Distributor:    Dave    Safford,    Texas    A&M   University,
  13238.                dave.safford@net.tamu.edu
  13239.  
  13240.  
  13241.              * Description: TAMU.99p12+ is the latest  release  in  the  TAMU
  13242.                linux  series.   Unlike  previous  releases, this one includes
  13243.                both integrated source and binary sets, with the entire binary
  13244.                set  created from a single top level source make. This ensures
  13245.                that all programs are compiled and linked with the  same  cur¡
  13246.                rent tools and libraries, and guarantees availability of work¡
  13247.                ing source for every program in the binary set.  In  addition,
  13248.                the  new  boot  diskette fully automates the installation pro¡
  13249.                cess, including partitioning, lilo bootstrapping, and  network
  13250.                configuration.   Installation   requires   no  rebooting,  and
  13251.  
  13252.  
  13253.                                 - 203 -
  13254.  
  13255.  
  13256.  
  13257.  
  13258.  
  13259.  
  13260.  
  13261.  
  13262.  
  13263.                requires the user to know only the host's name and IP address.
  13264.                At  every  step of installation, the program provides intelli¡
  13265.                gent defaults, making it a snap for  novices,  while  allowing
  13266.                experts  full  flexibility in setting installation parameters.
  13267.                Reliability has been improved over past TAMU  installation  by
  13268.                the  use of labels on all disk images, so that the program can
  13269.                detect and recover from bad or misordered diskettes.
  13270.  
  13271.  
  13272.                     This  release  is  a  full  featured  package,  including
  13273.                XFree86-1.3,  Emacs-19.18,  net-2,  bootutils, and sources for
  13274.                all installation programs (without any use restrictions).
  13275.  
  13276.  
  13277.              * Availability: The latest TAMU release is available  by  anony¡
  13278.                mous ftp from net.tamu.edu:pub/linux.
  13279.  
  13280.  
  13281.  
  13282.  
  13283.  
  13284.      B.3  Slackware Linux Distribution
  13285.  
  13286.  
  13287.  
  13288.  
  13289.              * Distributor: Patrick Volkerding, 
  13290.                 volkerdi@mhd1.moorhead.msus.edu
  13291.  
  13292.  
  13293.              * Description: Slackware Linux is a full  featured  distribution
  13294.                of  the  Linux operating system designed for 386/486 computers
  13295.                with a 3.5" floppy. Slackware changes rapidly,  but  here's  a
  13296.                current (partial) feature list:
  13297.  
  13298.  
  13299.                        * A  series  (14  disks):  Base  Linux 0.99pl13 OS and
  13300.                          utilities.    Networking,   UUCP,   gcc/g++   2.4.5,
  13301.                          libc-4.4.4, and more.
  13302.  
  13303.                        * E series (5 disks): Emacs 19.19.
  13304.  
  13305.                        * F  series (1 disk): FAQs, HOWTOs, and other documen¡
  13306.                          tation.
  13307.  
  13308.                        * OI series (3 disks): ObjectBuilder 2.0 for X.
  13309.  
  13310.                        * X series (5 disks): Base XFree86 2.0 X windows  sys¡
  13311.                          tem with fvwm.
  13312.  
  13313.  
  13314.  
  13315.  
  13316.                                 - 204 -
  13317.  
  13318.  
  13319.  
  13320.  
  13321.  
  13322.  
  13323.  
  13324.  
  13325.  
  13326.                        * XAP series (2 disks): X windows applications such as
  13327.                          seyon and ghostview.
  13328.  
  13329.                        * XD series (3 disks): X windows program/server devel¡
  13330.                          opment.
  13331.  
  13332.                        * XV  series (2 disks): XView 3.2 release 5, Open Look
  13333.                          Window Manager.
  13334.  
  13335.                        * Y series (1 disk): Games from BSD, such as hunt.
  13336.  
  13337.  
  13338.  
  13339.              * Availability: The home site is ftp.cdrom.com, where the latest
  13340.                distribution  can be found in /pub/linux/slackware. To make it
  13341.                easy to download, the disks can also  be  found  pre-zooed  in
  13342.                /pub/linux/zooed slackware.  (Zoo is a compression utility for
  13343.                MS-DOS).
  13344.  
  13345.  
  13346.              * Ordering: FTP only, although various independent  distributors
  13347.                provide it on disk, floppy, and CD.
  13348.  
  13349.  
  13350.  
  13351.  
  13352.  
  13353.      B.4  Linux from Nascent CD-ROM
  13354.  
  13355.      Yet another Linux Distribution with a bizarre name. Soon we'll be seeing
  13356.      CD-ROMs from ``Throatwobbler Mangrove Labs''.
  13357.  
  13358.  
  13359.  
  13360.  
  13361.              * Distributor: Nascent Technology
  13362.  
  13363.  
  13364.              * Description: The Linux from Nascent CDROM is a  new  distribu¡
  13365.                tion  of  the  Linux  operating system which includes over 400
  13366.                mbytes of source code, binaries, and documentation  for  Linux
  13367.                and  applications.  It features automated root, swap, package,
  13368.                network, and user account installation from CDROM.  Linux  can
  13369.                be  can be run directly from the CDROM and floppy. The Nascent
  13370.                CDROM features Xwindows, Openlook, TeX, GNU compiler and util¡
  13371.                ities,  Magic  and Spice electronic design tools, and over 100
  13372.                high resolution  images  translated  from  Kodak  PhotoCD(tm).
  13373.                Each  source  archive  is distributed with an associated notes
  13374.                file to allow you to browse and install applications  using  a
  13375.                consistent interface.
  13376.  
  13377.  
  13378.                     A listing of the contents of the Nascent CDROM as well as
  13379.                a current copy of the CDROM announcement and order form may be
  13380.  
  13381.  
  13382.                                 - 205 -
  13383.  
  13384.  
  13385.  
  13386.  
  13387.  
  13388.  
  13389.  
  13390.  
  13391.  
  13392.                obtained via anonymous ftp at netcom.com:/pub/nascent.
  13393.  
  13394.  
  13395.              * Ordering:  The  Linux from Nascent CDROM, Version 1.0, is only
  13396.                $39.95 plus shipping and handling.  Nascent  also  offers  the
  13397.                Linux  from  Nascent  Plus  package  for  only  $89.95,  which
  13398.                includes six months of email support and a 30% discount off  a
  13399.                future  release of the CDROM With your CDROM purchase. Nascent
  13400.                accepts Mastercard, VISA, checks, and money orders as payment.
  13401.  
  13402.  
  13403.                     To  order  your  Linux from Nascent CDROM, mail, email or
  13404.                fax a completed order form to:
  13405.  
  13406.  
  13407.                     Nascent Technology
  13408.                     Linux from Nascent CDROM
  13409.                     P.O. Box 60669
  13410.                     Sunnyvale CA 94088-0669 USA
  13411.                     Tel: (408) 737-9500
  13412.                     Fax: (408) 241-9390
  13413.                     Email: nascent@netcom.com
  13414.  
  13415.  
  13416.  
  13417.  
  13418.      B.5  Trans-Ameritech CD-ROM
  13419.  
  13420.  
  13421.  
  13422.  
  13423.              * Distributor: Trans-Ameritech, a California based  corporation.
  13424.  
  13425.  
  13426.              * Description:  CDROM  with  2  versions of SLS distribution---a
  13427.                very stable 1.02 and a newer  1.03---and  also  the  SLACKWARE
  13428.                distribution!  Linux installs directly from the CD-ROM on many
  13429.                hardware configurations.
  13430.  
  13431.  
  13432.                     It includes full X-Windows environment, TCP/IP networking
  13433.                including  NFS, several flavours of mail and news, full set of
  13434.                GNU tools and much more. Also  Multimedia---sound  board  sup¡
  13435.                port, image viewers and hundreds of megs of images and sounds.
  13436.  
  13437.  
  13438.                     In addition to the full SLS  distributions  we  supply  a
  13439.                ``live'' image of a configured system. Several versions of the
  13440.                Linux kernel precompiled to cover different  hardware  options
  13441.                including drivers for Sony-31A and Sound Blaster CD-ROMs.
  13442.  
  13443.  
  13444.              * Availability:  At  Trans-Ameritech  we ship the same day as we
  13445.                get the order! Our address is:
  13446.  
  13447.  
  13448.                                 - 206 -
  13449.  
  13450.  
  13451.  
  13452.  
  13453.  
  13454.  
  13455.  
  13456.  
  13457.  
  13458.                     2342A Walsh Avenue
  13459.                     Santa Clara, CA 95051
  13460.  
  13461.  
  13462.  
  13463.              * Ordering: You can order by phone  (408)  727-3883  or  by  FAX
  13464.                (408)   727-3882,   or  by  sending  e-mail  to:  roman@trans-
  13465.                ameritech.com.  Shipping and handeling for overseas (as in  UK
  13466.                and  Germany)  is  $8.   In  US is $5. Pay by cheque or credit
  13467.                card. COD in continental US is $4.50 extra if you want it.
  13468.  
  13469.  
  13470.                     The price for a single CD-ROM is  $30.  California  resi¡
  13471.                dents,  please include tax. PRICES ARE SUBJECT TO CHANGE WITH¡
  13472.                OUT NOTICE.
  13473.  
  13474.  
  13475.              * Miscellaneous: We answer technical questions about our distri¡
  13476.                bution  by e-mail sent to: roman@trans-ameritech.com within 24
  13477.                hours! Trans-Ameritech is  a  well  established  company  with
  13478.                efficient organization to guarantee on-time printing and ship¡
  13479.                ping of this product.  If you have a 3.5 inch boot floppy  and
  13480.                have ftp access, please look on sunsite.unc.edu in
  13481.  
  13482.  
  13483.                     /pub/Linux/distributions/TransAmer
  13484.  
  13485.  
  13486.                     for  a  new boot floppy image with support for many CDROM
  13487.                drives.
  13488.  
  13489.  
  13490.  
  13491.  
  13492.  
  13493.  
  13494.  
  13495.  
  13496.  
  13497.  
  13498.  
  13499.  
  13500.  
  13501.  
  13502.  
  13503.  
  13504.  
  13505.  
  13506.  
  13507.  
  13508.  
  13509.  
  13510.  
  13511.  
  13512.  
  13513.  
  13514.                                 - 207 -
  13515.  
  13516.  
  13517.  
  13518.  
  13519.  
  13520.  
  13521.  
  13522.  
  13523.  
  13524.                                       APPENDIX C
  13525.  
  13526.  
  13527.                             FTP Tutorial and Site List
  13528.  
  13529.  
  13530.  
  13531.  
  13532.           FTP (``File Transfer Protocol'') is the set of  programs  that  are
  13533.      used  for transferring files between systems on the Internet. Most UNIX,
  13534.      VMS, and MS-DOS systems on the Internet have a program called ftp  which
  13535.      you  use  to  transfer these files, and if you have Internet access, the
  13536.      best way to download the Linux software is by using ftp.  This  appendix
  13537.      covers  basic  ftp  usage---of course, there are many more functions and
  13538.      uses of ftp than are given here.
  13539.  
  13540.  
  13541.           At the end of this appendix there is a listing of FTP  sites  where
  13542.      Linux  software  can  be  found. Also, if you don't have direct Internet
  13543.      access but are able to  exchange  electronic  mail  with  the  Internet,
  13544.      information on using the ftpmail service is included below.
  13545.  
  13546.  
  13547.           If  you're  using  an MS-DOS, UNIX, or VMS system to download files
  13548.      from the Internet, then ftp is a command-driven program. However,  there
  13549.      are  other  implementations of ftp out there, such as the Macintosh ver¡
  13550.      sion (called Fetch) with a nice menu-driven interface,  which  is  quite
  13551.      self-explanatory. Even if you're not using the command-driven version of
  13552.      ftp, the information given here should help.
  13553.  
  13554.  
  13555.  
  13556.           ftp can be used to both upload (send) or download  (receive)  files
  13557.      from  other Internet sites. In most situations, you're going to be down¡
  13558.      loading software. On the Internet there are a large number of  publicly-
  13559.      available  FTP archive sites, machines which allow anyone to ftp to them
  13560.      and download free software. One such archive  site  is  sunsite.unc.edu,
  13561.      which  has  a  lot  of Sun Microsystems software, and acts as one of the
  13562.      main Linux sites. In addition, FTP archive sites mirror software to each
  13563.      other---that  is,  software  uploaded  to one site will be automatically
  13564.      copied over to a number of other sites. So don't be surprised if you see
  13565.      the exact same files on many different archive sites.
  13566.  
  13567.  
  13568.      C.1  Starting ftp
  13569.  
  13570.      Note  that in the example ``screens'' printed below I'm only showing the
  13571.      most important information, and what you see may differ. Also,  commands
  13572.      in  italics  represent commands that you type; everything else is screen
  13573.      output.
  13574.  
  13575.  
  13576.           To start ftp and connect to a site, simply use the command
  13577.  
  13578.  
  13579.  
  13580.                                 - 208 -
  13581.  
  13582.  
  13583.  
  13584.  
  13585.  
  13586.  
  13587.  
  13588.  
  13589.  
  13590.           ftp <hostname>
  13591.  
  13592.  
  13593.           where <hostname> is the name of the site  you  are  connecting  to.
  13594.      For example, to connect to the mythical site shoop.vpizza.com we can use
  13595.      the command
  13596.  
  13597.  
  13598.           ftp shoop.vpizza.com
  13599.  
  13600.  
  13601.  
  13602.  
  13603.      C.2  Logging In
  13604.  
  13605.      When ftp starts up we should see something like
  13606.  
  13607.  
  13608.           Connected to shoop.vpizza.com.
  13609.           220 Shoop.vpizza.com FTPD ready at 15 Dec  1992  08:20:42 EDT
  13610.           Name (shoop.vpizza.com:mdw):
  13611.  
  13612.  
  13613.           Here,  ftp  is asking us to give the username that we want to login
  13614.      as on shoop.vpizza.com. The default here is mdw, which is my username on
  13615.      the  system  I'm  using  FTP  from.  Since  I  don't  have an account on
  13616.      shoop.vpizza.com I can't login as myself. Instead, to  access  publicly-
  13617.      available  software on an FTP site you login as anonymous, and give your
  13618.      Internet e-mail address (if you have one) as the password.  So, we would
  13619.      type
  13620.  
  13621.  
  13622.           Name (shoop.vpizza.com:mdw): anonymous
  13623.           331-Guest login ok, send e-mail address as password.
  13624.           Password: mdw@sunsite.unc.edu
  13625.           230- Welcome to shoop.vpizza.com.
  13626.           230-  Virtual  Pizza  Delivery[tm]: Download pizza in 30 cycles or 
  13627.           230- less or you get it FREE!
  13628.           ftp>
  13629.  
  13630.  
  13631.           Of course, you should give your e-mail address,  instead  of  mine,
  13632.      and  it won't echo to the screen as you're typing it (since it's techni¡
  13633.      cally a ``password''). ftp should allow us to login and we'll  be  ready
  13634.      to download software.
  13635.  
  13636.  
  13637.      C.3  Poking Around
  13638.  
  13639.      Okay,  we're  in. ftp> is our prompt, and the ftp program is waiting for
  13640.      commands. There are a few basic commands you need to know about.  First,
  13641.      the commands
  13642.  
  13643.  
  13644.                                 - 209 -
  13645.  
  13646.  
  13647.  
  13648.  
  13649.  
  13650.  
  13651.  
  13652.  
  13653.  
  13654.           ls <file>
  13655.  
  13656.  
  13657.           and
  13658.  
  13659.  
  13660.           dir <file>
  13661.  
  13662.  
  13663.           both give file listings (where <file> is an optional argument spec¡
  13664.      ifying a particular filename to list). The difference is that ls usually
  13665.      gives a short listing and dir gives a longer listing (that is, with more
  13666.      information on the sizes of the files, dates  of  modification,  and  so
  13667.      on).
  13668.  
  13669.  
  13670.           The command
  13671.  
  13672.  
  13673.           cd <directory>
  13674.  
  13675.  
  13676.           will  move to the given directory (just like the cd command on UNIX
  13677.      or MS-DOS systems). You can use the command
  13678.  
  13679.  
  13680.           cdup
  13681.  
  13682.  
  13683.           to change to the parent directory(4) .
  13684.  
  13685.  
  13686.           The command
  13687.  
  13688.  
  13689.           help <command>
  13690.  
  13691.  
  13692.           will give help on the given ftp <command> (such as ls or cd). If no
  13693.      command is specified, ftp will list all of the available commands.
  13694.  
  13695.  
  13696.           If we type dir at this point we'll see an initial directory listing
  13697.      of where we are.
  13698.  
  13699.  
  13700.  
  13701.  
  13702.  
  13703.  
  13704.  
  13705.  
  13706.  
  13707.      
  13708.  
  13709.      4. The directory above the current one.
  13710.  
  13711.                                 - 210 -
  13712.  
  13713.  
  13714.  
  13715.  
  13716.  
  13717.  
  13718.  
  13719.  
  13720.  
  13721.           ftp> dir
  13722.           200 PORT command successful.
  13723.           150 Opening ASCII mode data connection for /bin/ls.
  13724.           total 1337
  13725.  
  13726.           dr-xr-xr-x  2 root     wheel         512 Aug 13 13:55 bin
  13727.           drwxr-xr-x  2 root     wheel         512 Aug 13 13:58 dev
  13728.           drwxr-xr-x  2 root     wheel         512 Jan 25 17:35 etc
  13729.           drwxr-xr-x 19 root     wheel        1024 Jan 27 21:39 pub
  13730.           drwxrwx-wx  4 root     ftp-admi     1024 Feb  6 22:10 uploads
  13731.           drwxr-xr-x  3 root     wheel         512 Mar 11  1992 usr
  13732.           226 Transfer complete.
  13733.           921 bytes received in 0.24 seconds (3.7 Kbytes/s)
  13734.           ftp>
  13735.  
  13736.  
  13737.  
  13738.  
  13739.           Each of these entries is a directory, not an individual file  which
  13740.      we can download (specified by the d in the first column of the listing).
  13741.      On most FTP archive sites, the publicly available software is under  the
  13742.      directory /pub, so let's go there.
  13743.  
  13744.  
  13745.           ftp> cd pub
  13746.           ftp> dir
  13747.           200 PORT command successful.
  13748.           150 ASCII data connection for /bin/ls (128.84.181.1,4525)
  13749.           (0 bytes).
  13750.           total 846
  13751.  
  13752.           -rw-r--r--   1 root     staff        1433 Jul 12  1988 README
  13753.           -r--r--r--   1 3807     staff       15586 May 13  1991 US-DOMAIN.TXT.2
  13754.           -rw-r--r--   1 539      staff       52664 Feb 20  1991 altenergy.avail
  13755.           -r--r--r--   1 65534    65534       56456 Dec 17  1990 ataxx.tar.Z
  13756.           -rw-r--r--   1 root     other     2013041 Jul  3  1991 gesyps.tar.Z
  13757.           -rw-r--r--   1 432      staff       41831 Jan 30  1989 gnexe.arc
  13758.           -rw-rw-rw-   1 615      staff       50315 Apr 16  1992 linpack.tar.Z
  13759.           -r--r--r--   1 root     wheel       12168 Dec 25  1990 localtime.o
  13760.           -rw-r--r--   1 root     staff        7035 Aug 27  1986 manualslist.tblms
  13761.           drwxr-xr-x   2 2195     staff         512 Mar 10 00:48 mdw
  13762.           -rw-r--r--   1 root     staff        5593 Jul 19  1988 t.out.h
  13763.           226 ASCII Transfer complete.
  13764.           2443 bytes received in 0.35 seconds (6.8 Kbytes/s)
  13765.           ftp>
  13766.  
  13767.  
  13768.  
  13769.  
  13770.           Here we can see a number of (interesting?) files, one of  which  is
  13771.      called  README,  which  we should download (most FTP sites have a README
  13772.      file in the /pub directory).
  13773.  
  13774.  
  13775.  
  13776.  
  13777.                                 - 211 -
  13778.  
  13779.  
  13780.  
  13781.  
  13782.  
  13783.  
  13784.  
  13785.  
  13786.  
  13787.      C.4  Downloading files
  13788.  
  13789.      Before downloading files, there are a few things that you need  to  take
  13790.      care of.
  13791.  
  13792.  
  13793.              * Turn  on  hash  mark  printing.  Hash marks are printed to the
  13794.                screen as files are being transferred; they let you  know  how
  13795.                far  along  the  transfer  is, and that your connection hasn't
  13796.                hung up (so you don't sit for 20 minutes, thinking that you're
  13797.                still  downloading a file). In general, a hash mark appears as
  13798.                a pound sign (#), and one is printed for every  1024  or  8192
  13799.                bytes transferred, depending on your system.
  13800.  
  13801.  
  13802.                     To turn on hash mark printing, give the command hash.
  13803.  
  13804.  
  13805.                     ftp> hash
  13806.                     Hash mark printing on (8192 bytes/hash mark).
  13807.                     ftp>
  13808.  
  13809.  
  13810.  
  13811.  
  13812.              * Determine  the type of file which you are downloading.  As far
  13813.                as FTP is concerned, files come in  two  flavors:  binary  and
  13814.                text. Most of the files which you'll be downloading are binary
  13815.                files: that is, programs, compressed files, archive files, and
  13816.                so  on.  However,  many  files (such as READMEs and so on) are
  13817.                text files.
  13818.  
  13819.  
  13820.                     Why does the file type matter? Only because on some  sys¡
  13821.                tems  (such  as  MS-DOS systems), certain characters in a text
  13822.                file, such as carriage returns, need to be converted  so  that
  13823.                the  file will be readable. While transferring in binary mode,
  13824.                no conversion is done---the file is  simply  transferred  byte
  13825.                after byte.
  13826.  
  13827.  
  13828.                     The  commands  bin  and  ascii  set  the transfer mode to
  13829.                binary and text,  respectively.  When  in  doubt,  always  use
  13830.                binary  mode  to  transfer  files.   If  you try to transfer a
  13831.                binary file in text mode, you'll corrupt the file and it  will
  13832.                be  unusable.  (This  is  one of the most common mistakes made
  13833.                when using FTP.) However, you can use text mode for plain text
  13834.                files (whose filenames often end in .txt).
  13835.  
  13836.  
  13837.                     For our example, we're downloading the file README, which
  13838.                is most likely a text file, so we use the command
  13839.  
  13840.  
  13841.  
  13842.  
  13843.                                 - 212 -
  13844.  
  13845.  
  13846.  
  13847.  
  13848.  
  13849.  
  13850.  
  13851.  
  13852.  
  13853.                     ftp> ascii
  13854.                     200 Type set to A.
  13855.                     ftp>
  13856.  
  13857.  
  13858.  
  13859.  
  13860.              * Set your local directory. Your local directory is  the  direc¡
  13861.                tory on your system where you want the downloaded files to end
  13862.                up.  Whereas the cd command changes the remote  directory  (on
  13863.                the  remote  machine  which you're FTPing to), the lcd command
  13864.                changes the local directory.
  13865.  
  13866.  
  13867.                     For   example,   to   set   the   local   directory    to
  13868.                /home/db/mdw/tmp, use the command
  13869.  
  13870.  
  13871.                     ftp> lcd /home/db/mdw/tmp
  13872.                     Local directory now /home/db/mdw/tmp
  13873.                     ftp>
  13874.  
  13875.  
  13876.  
  13877.  
  13878.  
  13879.           Now you're ready to actually download the file. The command
  13880.  
  13881.  
  13882.           get <remote-name> <local-name>
  13883.  
  13884.  
  13885.           is  used  for  this, where <remote-name> is the name of the file on
  13886.      the remote machine, and <local-name> is the name that you wish  to  give
  13887.      the  file  on your local machine. The <local-name> argument is optional;
  13888.      by default, the local filename is the same as the remote  one.  However,
  13889.      if  for example you're downloading the file README, and you already have
  13890.      a README in your local  directory,  you'll  want  to  give  a  different
  13891.      <local-filename> so that the first one isn't overwritten.
  13892.  
  13893.  
  13894.           For our example, to download the file README, we simply use
  13895.  
  13896.  
  13897.  
  13898.  
  13899.  
  13900.  
  13901.  
  13902.  
  13903.  
  13904.  
  13905.  
  13906.  
  13907.  
  13908.  
  13909.                                 - 213 -
  13910.  
  13911.  
  13912.  
  13913.  
  13914.  
  13915.  
  13916.  
  13917.  
  13918.  
  13919.           ftp> get README
  13920.           200 PORT command successful.
  13921.           150  ASCII data connection for README (128.84.181.1,4527)
  13922.           (1433 bytes).
  13923.           #
  13924.           226 ASCII Transfer complete.
  13925.           local: README remote: README
  13926.           1493 bytes received in 0.03 seconds (49 Kbytes/s)
  13927.           ftp>
  13928.  
  13929.  
  13930.  
  13931.  
  13932.      C.5  Quitting FTP
  13933.  
  13934.      To end your FTP session, simply use the command
  13935.  
  13936.  
  13937.           quit
  13938.  
  13939.  
  13940.           The command
  13941.  
  13942.  
  13943.           close
  13944.  
  13945.  
  13946.           can be used to close the connection with  the  current  remote  FTP
  13947.      site;  the open command can then be used to start a session with another
  13948.      site (without quitting the FTP program altogether).
  13949.  
  13950.  
  13951.           ftp> close
  13952.           221 Goodbye.
  13953.           ftp> quit
  13954.  
  13955.  
  13956.  
  13957.  
  13958.      C.6  Using ftpmail
  13959.  
  13960.      ftpmail is a service which allows you to obtain files from  FTP  archive
  13961.      sites  via  Internet  electronic mail. If you don't have direct Internet
  13962.      access, but are able to send mail to the Internet (from a  service  such
  13963.      as CompuServe, for example), ftpmail is a good way to get files from FTP
  13964.      archive sites. Unfortunately, ftpmail can be slow, especially when send¡
  13965.      ing  large jobs. Before attempting to download large amounts of software
  13966.      using ftpmail, be sure that your mail spool will be able to  handle  the
  13967.      incoming  traffic. Many systems keep quotas on incoming electronic mail,
  13968.      and may delete your account if your mail exceeds this  quota.  Just  use
  13969.      common sense.
  13970.  
  13971.  
  13972.           sunsite.unc.edu,  one of the major Linux FTP archive sites, is home
  13973.  
  13974.  
  13975.                                 - 214 -
  13976.  
  13977.  
  13978.  
  13979.  
  13980.  
  13981.  
  13982.  
  13983.  
  13984.  
  13985.      to an ftpmail server. To use this service, send electronic mail to
  13986.  
  13987.  
  13988.           ftpmail@sunsite.unc.edu
  13989.  
  13990.  
  13991.           with a message body containing only the word:
  13992.  
  13993.  
  13994.           help
  13995.  
  13996.  
  13997.           This will send you back a list of  ftpmail  commands  and  a  brief
  13998.      tutorial on using the system.
  13999.  
  14000.  
  14001.           For  example,  to  get  a  listing  of  Linux  files  found on sun¡
  14002.      site.unc.edu, send mail to the above address containing the text
  14003.  
  14004.  
  14005.           open sunsite.unc.edu
  14006.           cd /pub/Linux
  14007.           dir
  14008.           quit
  14009.  
  14010.  
  14011.  
  14012.  
  14013.           You may use the ftpmail service to connect to any FTP archive site;
  14014.      you  are not limited to sunsite.unc.edu. The next section lists a number
  14015.      of Linux FTP archives.
  14016.  
  14017.  
  14018.      C.7  Linux FTP Site List
  14019.  
  14020.      Table C.7 is a listing of the most well-known FTP  archive  sites  which
  14021.      carry  the  Linux  software.  Keep  in mind that many other sites mirror
  14022.      these, and more than likely you'll run into Linux on a number  of  sites
  14023.      not on this list.
  14024.  
  14025.  
  14026.  
  14027.  
  14028.  
  14029.           tsx-11.mit.edu,  sunsite.unc.edu,  and  nic.funet.fi are the ``home
  14030.      sites'' for the Linux software,  where  most  of  the  new  software  is
  14031.      uploaded. Most of the other sites on the list mirror some combination of
  14032.      these three. To reduce network traffic, choose a site that is geographi¡
  14033.      cally closest to you.
  14034.  
  14035.  
  14036.  
  14037.  
  14038.  
  14039.  
  14040.  
  14041.                                 - 215 -
  14042.  
  14043.  
  14044.  
  14045.  
  14046.  
  14047.  
  14048.  
  14049.  
  14050.  
  14051.  
  14052.             +---------------------------------------------------------+
  14053.             |Site name/IP Address                Directory            |
  14054.         |---------------------------------------------------------|
  14055.             |tsx-11.mit.edu                                           |
  14056.             |               (18.172.1.2)         /pub/linux           |
  14057.             |sunsite.unc.edu                                          |
  14058.             |               (152.2.22.81)        /pub/Linux           |
  14059.             |nic.funet.fi                                             |
  14060.             |               (128.214.6.100)      /pub/OS/Linux        |
  14061.             |ftp.mcc.ac.uk                                            |
  14062.             |               (130.88.200.7)       /pub/linux           |
  14063.             |fgb1.fgb.mw.tu-muenchen.de                               |
  14064.             |               (129.187.200.1)      /pub/linux           |
  14065.             |ftp.informatik.tu-muenchen.de                            |
  14066.             |               (131.159.0.110)      /pub/Linux           |
  14067.             |ftp.dfv.rwth-aachen.de                                   |
  14068.             |               (137.226.4.105)      /pub/linux           |
  14069.             |ftp.informatik.rwth-aachen.de                            |
  14070.             |               (137.226.112.172)    /pub/Linux           |
  14071.             |ftp.ibp.fr                                               |
  14072.             |               (132.227.60.2)       /pub/linux           |
  14073.             |kirk.bu.oz.au                                            |
  14074.             |               (131.244.1.1)        /pub/OS/Linux        |
  14075.             |ftp.uu.net                                               |
  14076.             |               (137.39.1.9)         /systems/unix/linux  |
  14077.             |wuarchive.wustl.edu                                      |
  14078.             |               (128.252.135.4)      /systems/linux       |
  14079.             |ftp.win.tue.nl                                           |
  14080.             |               (131.155.70.100)     /pub/linux           |
  14081.             |ftp.stack.urc.tue.nl                                     |
  14082.             |               (131.155.2.71)       /pub/linux           |
  14083.             |ftp.ibr.cs.tu-bs.de                                      |
  14084.             |               (134.169.34.15)      /pub/os/linux        |
  14085.             |ftp.denet.dk                                             |
  14086.             |               (129.142.6.74)       /pub/OS/linux        |
  14087.             +---------------------------------------------------------+
  14088.  
  14089.  
  14090.  
  14091.  
  14092.  
  14093.  
  14094.                           TABLE 3.  Linux FTP Sites
  14095.  
  14096.  
  14097.  
  14098.  
  14099.  
  14100.                                       APPENDIX D
  14101.  
  14102.  
  14103.                           The GNU General Public License
  14104.  
  14105.  
  14106.  
  14107.  
  14108.           Printed  below  is the GNU General Public License (the GPL or copy¡
  14109.      left), under which Linux is licensed. It is reproduced here to clear  up
  14110.      some  of  the  confusion  about  Linux's copyright status---Linux is not
  14111.      shareware, and it is not in the public domain. The  bulk  of  the  Linux
  14112.      kernel  is  copyright  (C)1993 by Linus Torvalds, and other software and
  14113.      parts of the kernel are copyrighted by their authors.   Thus,  Linux  is
  14114.      copyrighted, however, you may redistribute it under the terms of the GPL
  14115.      printed below.
  14116.  
  14117.  
  14118.             GNU GENERAL PUBLIC LICENSE
  14119.                Version 2, June 1991
  14120.  
  14121.  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  14122.                           675 Mass Ave, Cambridge, MA 02139, USA
  14123.  Everyone is permitted to copy and distribute verbatim copies
  14124.  of this license document, but changing it is not allowed.
  14125.  
  14126.                 Preamble
  14127.  
  14128.   The licenses for most software are designed to take away your
  14129. freedom to share and change it.  By contrast, the GNU General Public
  14130. License is intended to guarantee your freedom to share and change free
  14131. software--to make sure the software is free for all its users.  This
  14132. General Public License applies to most of the Free Software
  14133. Foundation's software and to any other program whose authors commit to
  14134. using it.  (Some other Free Software Foundation software is covered by
  14135. the GNU Library General Public License instead.)  You can apply it to
  14136. your programs, too.
  14137.  
  14138.   When we speak of free software, we are referring to freedom, not
  14139. price.  Our General Public Licenses are designed to make sure that you
  14140. have the freedom to distribute copies of free software (and charge for
  14141. this service if you wish), that you receive source code or can get it
  14142. if you want it, that you can change the software or use pieces of it
  14143. in new free programs; and that you know you can do these things.
  14144.  
  14145.   To protect your rights, we need to make restrictions that forbid
  14146. anyone to deny you these rights or to ask you to surrender the rights.
  14147. These restrictions translate to certain responsibilities for you if you
  14148. distribute copies of the software, or if you modify it.
  14149.  
  14150.   For example, if you distribute copies of such a program, whether
  14151. gratis or for a fee, you must give the recipients all the rights that
  14152. you have.  You must make sure that they, too, receive or can get the
  14153. source code.  And you must show them these terms so they know their
  14154. rights.
  14155.  
  14156.   We protect your rights with two steps: (1) copyright the software, and
  14157. (2) offer you this license which gives you legal permission to copy,
  14158. distribute and/or modify the software.
  14159.  
  14160.   Also, for each author's protection and ours, we want to make certain
  14161. that everyone understands that there is no warranty for this free
  14162. software.  If the software is modified by someone else and passed on, we
  14163. want its recipients to know that what they have is not the original, so
  14164. that any problems introduced by others will not reflect on the original
  14165. authors' reputations.
  14166.  
  14167.   Finally, any free program is threatened constantly by software
  14168. patents.  We wish to avoid the danger that redistributors of a free
  14169. program will individually obtain patent licenses, in effect making the
  14170. program proprietary.  To prevent this, we have made it clear that any
  14171. patent must be licensed for everyone's free use or not licensed at all.
  14172.  
  14173.   The precise terms and conditions for copying, distribution and
  14174. modification follow.
  14175.  
  14176.             GNU GENERAL PUBLIC LICENSE
  14177.    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  14178.  
  14179.   0. This License applies to any program or other work which contains
  14180. a notice placed by the copyright holder saying it may be distributed
  14181. under the terms of this General Public License.  The "Program", below,
  14182. refers to any such program or work, and a "work based on the Program"
  14183. means either the Program or any derivative work under copyright law:
  14184. that is to say, a work containing the Program or a portion of it,
  14185. either verbatim or with modifications and/or translated into another
  14186. language.  (Hereinafter, translation is included without limitation in
  14187. the term "modification".)  Each licensee is addressed as "you".
  14188.  
  14189. Activities other than copying, distribution and modification are not
  14190. covered by this License; they are outside its scope.  The act of
  14191. running the Program is not restricted, and the output from the Program
  14192. is covered only if its contents constitute a work based on the
  14193. Program (independent of having been made by running the Program).
  14194. Whether that is true depends on what the Program does.
  14195.  
  14196.   1. You may copy and distribute verbatim copies of the Program's
  14197. source code as you receive it, in any medium, provided that you
  14198. conspicuously and appropriately publish on each copy an appropriate
  14199. copyright notice and disclaimer of warranty; keep intact all the
  14200. notices that refer to this License and to the absence of any warranty;
  14201. and give any other recipients of the Program a copy of this License
  14202. along with the Program.
  14203.  
  14204. You may charge a fee for the physical act of transferring a copy, and
  14205. you may at your option offer warranty protection in exchange for a fee.
  14206.  
  14207.   2. You may modify your copy or copies of the Program or any portion
  14208. of it, thus forming a work based on the Program, and copy and
  14209. distribute such modifications or work under the terms of Section 1
  14210. above, provided that you also meet all of these conditions:
  14211.  
  14212.     a) You must cause the modified files to carry prominent notices
  14213.     stating that you changed the files and the date of any change.
  14214.  
  14215.     b) You must cause any work that you distribute or publish, that in
  14216.     whole or in part contains or is derived from the Program or any
  14217.     part thereof, to be licensed as a whole at no charge to all third
  14218.     parties under the terms of this License.
  14219.  
  14220.     c) If the modified program normally reads commands interactively
  14221.     when run, you must cause it, when started running for such
  14222.     interactive use in the most ordinary way, to print or display an
  14223.     announcement including an appropriate copyright notice and a
  14224.     notice that there is no warranty (or else, saying that you provide
  14225.     a warranty) and that users may redistribute the program under
  14226.     these conditions, and telling the user how to view a copy of this
  14227.     License.  (Exception: if the Program itself is interactive but
  14228.     does not normally print such an announcement, your work based on
  14229.     the Program is not required to print an announcement.)
  14230.  
  14231. These requirements apply to the modified work as a whole.  If
  14232. identifiable sections of that work are not derived from the Program,
  14233. and can be reasonably considered independent and separate works in
  14234. themselves, then this License, and its terms, do not apply to those
  14235. sections when you distribute them as separate works.  But when you
  14236. distribute the same sections as part of a whole which is a work based
  14237. on the Program, the distribution of the whole must be on the terms of
  14238. this License, whose permissions for other licensees extend to the
  14239. entire whole, and thus to each and every part regardless of who wrote it.
  14240.  
  14241. Thus, it is not the intent of this section to claim rights or contest
  14242. your rights to work written entirely by you; rather, the intent is to
  14243. exercise the right to control the distribution of derivative or
  14244. collective works based on the Program.
  14245.  
  14246. In addition, mere aggregation of another work not based on the Program
  14247. with the Program (or with a work based on the Program) on a volume of
  14248. a storage or distribution medium does not bring the other work under
  14249. the scope of this License.
  14250.  
  14251.   3. You may copy and distribute the Program (or a work based on it,
  14252. under Section 2) in object code or executable form under the terms of
  14253. Sections 1 and 2 above provided that you also do one of the following:
  14254.  
  14255.     a) Accompany it with the complete corresponding machine-readable
  14256.     source code, which must be distributed under the terms of Sections
  14257.     1 and 2 above on a medium customarily used for software interchange; or,
  14258.  
  14259.     b) Accompany it with a written offer, valid for at least three
  14260.     years, to give any third party, for a charge no more than your
  14261.     cost of physically performing source distribution, a complete
  14262.     machine-readable copy of the corresponding source code, to be
  14263.     distributed under the terms of Sections 1 and 2 above on a medium
  14264.     customarily used for software interchange; or,
  14265.  
  14266.     c) Accompany it with the information you received as to the offer
  14267.     to distribute corresponding source code.  (This alternative is
  14268.     allowed only for noncommercial distribution and only if you
  14269.     received the program in object code or executable form with such
  14270.     an offer, in accord with Subsection b above.)
  14271.  
  14272. The source code for a work means the preferred form of the work for
  14273. making modifications to it.  For an executable work, complete source
  14274. code means all the source code for all modules it contains, plus any
  14275. associated interface definition files, plus the scripts used to
  14276. control compilation and installation of the executable.  However, as a
  14277. special exception, the source code distributed need not include
  14278. anything that is normally distributed (in either source or binary
  14279. form) with the major components (compiler, kernel, and so on) of the
  14280. operating system on which the executable runs, unless that component
  14281. itself accompanies the executable.
  14282.  
  14283. If distribution of executable or object code is made by offering
  14284. access to copy from a designated place, then offering equivalent
  14285. access to copy the source code from the same place counts as
  14286. distribution of the source code, even though third parties are not
  14287. compelled to copy the source along with the object code.
  14288.  
  14289.   4. You may not copy, modify, sublicense, or distribute the Program
  14290. except as expressly provided under this License.  Any attempt
  14291. otherwise to copy, modify, sublicense or distribute the Program is
  14292. void, and will automatically terminate your rights under this License.
  14293. However, parties who have received copies, or rights, from you under
  14294. this License will not have their licenses terminated so long as such
  14295. parties remain in full compliance.
  14296.  
  14297.   5. You are not required to accept this License, since you have not
  14298. signed it.  However, nothing else grants you permission to modify or
  14299. distribute the Program or its derivative works.  These actions are
  14300. prohibited by law if you do not accept this License.  Therefore, by
  14301. modifying or distributing the Program (or any work based on the
  14302. Program), you indicate your acceptance of this License to do so, and
  14303. all its terms and conditions for copying, distributing or modifying
  14304. the Program or works based on it.
  14305.  
  14306.   6. Each time you redistribute the Program (or any work based on the
  14307. Program), the recipient automatically receives a license from the
  14308. original licensor to copy, distribute or modify the Program subject to
  14309. these terms and conditions.  You may not impose any further
  14310. restrictions on the recipients' exercise of the rights granted herein.
  14311. You are not responsible for enforcing compliance by third parties to
  14312. this License.
  14313.  
  14314.   7. If, as a consequence of a court judgment or allegation of patent
  14315. infringement or for any other reason (not limited to patent issues),
  14316. conditions are imposed on you (whether by court order, agreement or
  14317. otherwise) that contradict the conditions of this License, they do not
  14318. excuse you from the conditions of this License.  If you cannot
  14319. distribute so as to satisfy simultaneously your obligations under this
  14320. License and any other pertinent obligations, then as a consequence you
  14321. may not distribute the Program at all.  For example, if a patent
  14322. license would not permit royalty-free redistribution of the Program by
  14323. all those who receive copies directly or indirectly through you, then
  14324. the only way you could satisfy both it and this License would be to
  14325. refrain entirely from distribution of the Program.
  14326.  
  14327. If any portion of this section is held invalid or unenforceable under
  14328. any particular circumstance, the balance of the section is intended to
  14329. apply and the section as a whole is intended to apply in other
  14330. circumstances.
  14331.  
  14332. It is not the purpose of this section to induce you to infringe any
  14333. patents or other property right claims or to contest validity of any
  14334. such claims; this section has the sole purpose of protecting the
  14335. integrity of the free software distribution system, which is
  14336. implemented by public license practices.  Many people have made
  14337. generous contributions to the wide range of software distributed
  14338. through that system in reliance on consistent application of that
  14339. system; it is up to the author/donor to decide if he or she is willing
  14340. to distribute software through any other system and a licensee cannot
  14341. impose that choice.
  14342.  
  14343. This section is intended to make thoroughly clear what is believed to
  14344. be a consequence of the rest of this License.
  14345.  
  14346.   8. If the distribution and/or use of the Program is restricted in
  14347. certain countries either by patents or by copyrighted interfaces, the
  14348. original copyright holder who places the Program under this License
  14349. may add an explicit geographical distribution limitation excluding
  14350. those countries, so that distribution is permitted only in or among
  14351. countries not thus excluded.  In such case, this License incorporates
  14352. the limitation as if written in the body of this License.
  14353.  
  14354.   9. The Free Software Foundation may publish revised and/or new versions
  14355. of the General Public License from time to time.  Such new versions will
  14356. be similar in spirit to the present version, but may differ in detail to
  14357. address new problems or concerns.
  14358.  
  14359. Each version is given a distinguishing version number.  If the Program
  14360. specifies a version number of this License which applies to it and "any
  14361. later version", you have the option of following the terms and conditions
  14362. either of that version or of any later version published by the Free
  14363. Software Foundation.  If the Program does not specify a version number of
  14364. this License, you may choose any version ever published by the Free Software
  14365. Foundation.
  14366.  
  14367.   10. If you wish to incorporate parts of the Program into other free
  14368. programs whose distribution conditions are different, write to the author
  14369. to ask for permission.  For software which is copyrighted by the Free
  14370. Software Foundation, write to the Free Software Foundation; we sometimes
  14371. make exceptions for this.  Our decision will be guided by the two goals
  14372. of preserving the free status of all derivatives of our free software and
  14373. of promoting the sharing and reuse of software generally.
  14374.  
  14375.                 NO WARRANTY
  14376.  
  14377.   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  14378. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  14379. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  14380. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  14381. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14382. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  14383. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  14384. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  14385. REPAIR OR CORRECTION.
  14386.  
  14387.   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  14388. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  14389. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  14390. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  14391. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  14392. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  14393. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  14394. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  14395. POSSIBILITY OF SUCH DAMAGES.
  14396.  
  14397.              END OF TERMS AND CONDITIONS
  14398.  
  14399.     Appendix: How to Apply These Terms to Your New Programs
  14400.  
  14401.   If you develop a new program, and you want it to be of the greatest
  14402. possible use to the public, the best way to achieve this is to make it
  14403. free software which everyone can redistribute and change under these terms.
  14404.  
  14405.   To do so, attach the following notices to the program.  It is safest
  14406. to attach them to the start of each source file to most effectively
  14407. convey the exclusion of warranty; and each file should have at least
  14408. the "copyright" line and a pointer to where the full notice is found.
  14409.  
  14410.     <one line to give the program's name and a brief idea of what it does.>
  14411.     Copyright (C) 19yy  <name of author>
  14412.  
  14413.     This program is free software; you can redistribute it and/or modify
  14414.     it under the terms of the GNU General Public License as published by
  14415.     the Free Software Foundation; either version 2 of the License, or
  14416.     (at your option) any later version.
  14417.  
  14418.     This program is distributed in the hope that it will be useful,
  14419.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14420.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14421.     GNU General Public License for more details.
  14422.  
  14423.     You should have received a copy of the GNU General Public License
  14424.     along with this program; if not, write to the Free Software
  14425.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14426.  
  14427. Also add information on how to contact you by electronic and paper mail.
  14428.  
  14429. If the program is interactive, make it output a short notice like this
  14430. when it starts in an interactive mode:
  14431.  
  14432.     Gnomovision version 69, Copyright (C) 19yy name of author
  14433.     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  14434.     This is free software, and you are welcome to redistribute it
  14435.     under certain conditions; type `show c' for details.
  14436.  
  14437. The hypothetical commands `show w' and `show c' should show the appropriate
  14438. parts of the General Public License.  Of course, the commands you use may
  14439. be called something other than `show w' and `show c'; they could even be
  14440. mouse-clicks or menu items--whatever suits your program.
  14441.  
  14442. You should also get your employer (if you work as a programmer) or your
  14443. school, if any, to sign a "copyright disclaimer" for the program, if
  14444. necessary.  Here is a sample; alter the names:
  14445.  
  14446.   Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  14447.   `Gnomovision' (which makes passes at compilers) written by James Hacker.
  14448.  
  14449.   <signature of Ty Coon>, 1 April 1989
  14450.   Ty Coon, President of Vice
  14451.  
  14452. This General Public License does not permit incorporating your program into
  14453. proprietary programs.  If your program is a subroutine library, you may
  14454. consider it more useful to permit linking proprietary applications with the
  14455. library.  If this is what you want to do, use the GNU Library General
  14456. Public License instead of this License.
  14457.  
  14458.  
  14459.  
  14460.  
  14461.                                      CONTENTS
  14462.  
  14463.  
  14464.  
  14465.      1. Preface ............................................... 2
  14466.         Audience .............................................. 2
  14467.         Organization .......................................... 3
  14468.         Acknowledgments ....................................... 4
  14469.         Credits and Legalese .................................. 4
  14470.         Documentation Conventions ............................. 8
  14471.  
  14472.      2. Introduction to Linux ................................ 10
  14473.         2.1  About This Book ................................. 10
  14474.         2.2  A Brief History of Linux ........................ 11
  14475.         2.3  System Features ................................. 14
  14476.         2.4  Software Features ............................... 16
  14477.         2.5  About Linux's Copyright ......................... 29
  14478.         2.6  The Design and Philosophy of Linux .............. 30
  14479.         2.7  Differences Between Linux and Other Operating
  14480.              Systems ......................................... 35
  14481.         2.8  Hardware Requirements ........................... 39
  14482.         2.9  Sources of Linux Information .................... 44
  14483.         2.10 Getting Help .................................... 49
  14484.  
  14485.      3. Obtaining and Installing Linux ....................... 53
  14486.         3.1  Distributions of Linux .......................... 53
  14487.         3.2  Preparing to Install Linux ...................... 56
  14488.         3.3  Installing the Linux software ................... 62
  14489.         3.4  Postinstallation procedures ..................... 73
  14490.         3.5  Running Into Trouble ............................ 74
  14491.  
  14492.      4. Linux Tutorial ....................................... 91
  14493.         4.1  Introduction .................................... 91
  14494.         4.2  Basic UNIX Concepts ............................. 91
  14495.         4.3  First Steps into UNIX ........................... 98
  14496.         4.4  Summary of Basic Commands ...................... 104
  14497.         4.5  Exploring the File System ...................... 107
  14498.         4.6  Types of shells ................................ 112
  14499.         4.7  Wildcards ...................................... 113
  14500.         4.8  UNIX Plumbing .................................. 116
  14501.         4.9  File Permissions ............................... 120
  14502.         4.10 Job Control .................................... 124
  14503.         4.11 Using the vi Editor ............................ 130
  14504.         4.12 Customizing your Environment ................... 139
  14505.         4.13 So You Want to Strike Out on Your Own? ......... 145
  14506.  
  14507.      5. System Administration ............................... 146
  14508.         5.1  About Root, Hats, and the Feeling of Power  .... 146
  14509.         5.2  Booting the System  ............................ 150
  14510.         5.3  Shutting Down .................................. 153
  14511.         5.4  Managing Users ................................. 154
  14512.         5.5  Archiving and Compressing Files ................ 158
  14513.         5.6  Using Floppies and Making Backups .............. 162
  14514.  
  14515.  
  14516.  
  14517.                                    i
  14518.  
  14519.  
  14520.  
  14521.  
  14522.  
  14523.  
  14524.  
  14525.  
  14526.  
  14527.         5.7  Upgrading and Installing New Software .......... 164
  14528.         5.8  Managing Filesystems ........................... 169
  14529.         5.9  Using a swap file .............................. 172
  14530.         5.10 Miscellaneous Tasks ............................ 173
  14531.         5.11 What To Do In An Emergency ..................... 178
  14532.  
  14533.      6. Advanced Features ................................... 181
  14534.         6.1  The X Window System ............................ 181
  14535.         6.2  Networking with TCP/IP ......................... 189
  14536.         6.3  Networking with UUCP ........................... 190
  14537.         6.4  Electronic Mail ................................ 191
  14538.         6.5  News and USENET ................................ 191
  14539.  
  14540.      APPENDIX A: Sources of Linux Information ............... 194
  14541.         A.1  Online Documents ............................... 194
  14542.         A.2  Linux Documentation Project Manuals ............ 196
  14543.         A.3  Books and Other Published Works ................ 197
  14544.  
  14545.      APPENDIX B: Linux Distribution and Mail Order List ..... 202
  14546.         B.1  MCC Interim Linux .............................. 202
  14547.         B.2  TAMU Linux Distribution ........................ 203
  14548.         B.3  Slackware Linux Distribution ................... 204
  14549.         B.4  Linux from Nascent CD-ROM ...................... 205
  14550.         B.5  Trans-Ameritech CD-ROM ......................... 206
  14551.  
  14552.      APPENDIX C: FTP Tutorial and Site List ................. 208
  14553.         C.1  Starting ftp ................................... 208
  14554.         C.2  Logging In ..................................... 209
  14555.         C.3  Poking Around .................................. 209
  14556.         C.4  Downloading files .............................. 212
  14557.         C.5  Quitting FTP ................................... 214
  14558.         C.6  Using ftpmail .................................. 214
  14559.         C.7  Linux FTP Site List ............................ 215
  14560.  
  14561.      APPENDIX D: The GNU General Public License ............. 217
  14562.  
  14563.  
  14564.  
  14565.  
  14566.  
  14567.                                   ii
  14568.  
  14569.  
  14570.  
  14571.